Index: include/gpu/GrContextFactory.h |
diff --git a/include/gpu/GrContextFactory.h b/include/gpu/GrContextFactory.h |
index 1f1f89df14d1995f5751f15b13c4508ce968539f..01e0239b1a16d966587994263c1f4290bf246e94 100644 |
--- a/include/gpu/GrContextFactory.h |
+++ b/include/gpu/GrContextFactory.h |
@@ -94,13 +94,24 @@ public: |
void destroyContexts() { |
for (int i = 0; i < fContexts.count(); ++i) { |
- fContexts[i].fGLContext->makeCurrent(); |
+ if (NULL != fContexts[i].fGLContext) { // could be abandoned. |
+ fContexts[i].fGLContext->makeCurrent(); |
+ } |
fContexts[i].fGrContext->unref(); |
- fContexts[i].fGLContext->unref(); |
+ if (NULL != fContexts[i].fGLContext) { |
+ fContexts[i].fGLContext->unref(); |
+ } |
} |
fContexts.reset(); |
} |
+ void abandonContexts() { |
+ for (int i = 0; i < fContexts.count(); ++i) { |
+ SkSafeSetNull(fContexts[i].fGLContext); |
+ fContexts[i].fGrContext->abandonContext(); |
+ } |
+ } |
+ |
/** |
* Get a GrContext initialized with a type of GL context. It also makes the GL context current. |
*/ |