Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / skia / src / gpu / gl / iOS / SkNativeGLContext_iOS.mm
index 1e11c0d..1bdaf70 100644 (file)
@@ -36,10 +36,13 @@ SkNativeGLContext::~SkNativeGLContext() {
 }
 
 void SkNativeGLContext::destroyGLContext() {
-    if ([EAGLContext currentContext] == EAGLCTX) {
-        [EAGLContext setCurrentContext:nil];
+    if (fEAGLContext) {
+        if ([EAGLContext currentContext] == EAGLCTX) {
+            [EAGLContext setCurrentContext:nil];
+        }
+        [EAGLCTX release];
+        fEAGLContext = NULL;
     }
-    [EAGLCTX release];
 }
 
 const GrGLInterface* SkNativeGLContext::createGLContext(GrGLStandard forcedGpuAPI) {