Speculative fix for Android Debug only crash in r4049
http://codereview.appspot.com/6251049/
git-svn-id: http://skia.googlecode.com/svn/trunk@4053 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h
index c9c15df..470741e 100644
--- a/include/gpu/GrContext.h
+++ b/include/gpu/GrContext.h
@@ -857,8 +857,13 @@
}
~GrAutoScratchTexture() {
+ this->reset();
+ }
+
+ void reset() {
if (NULL != fContext) {
fContext->unlockTexture(fEntry);
+ fEntry.reset();
}
}
@@ -866,10 +871,8 @@
const GrTextureDesc& desc,
GrContext::ScratchTexMatch match =
GrContext::kApprox_ScratchTexMatch) {
- if (NULL != fContext) {
- fContext->unlockTexture(fEntry);
- fEntry.reset();
- }
+ this->reset();
+
fContext = context;
if (NULL != fContext) {
fEntry = fContext->lockScratchTexture(desc, match);