8057830: Crash in Java2D Queue Flusher, OGLSD_SetScratchSurface
authorserb
Fri, 31 Oct 2014 19:45:54 +0300
changeset 27510 573e93cd3123
parent 27509 74d054f0fee6
child 27511 4b0eecf677c0
8057830: Crash in Java2D Queue Flusher, OGLSD_SetScratchSurface Reviewed-by: serb, denis Contributed-by: Hendrik Schreiber <hs@tagtraum.com>
jdk/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLGraphicsConfig.m
jdk/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLSurfaceData.m
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLGraphicsConfig.m	Fri Oct 31 12:38:46 2014 +0300
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLGraphicsConfig.m	Fri Oct 31 19:45:54 2014 +0300
@@ -72,7 +72,9 @@
             }
             [pool drain];
             free(ctxinfo);
+            oglc->ctxInfo = NULL;
         }
+        cglinfo->context = NULL;
     }
 
     free(cglinfo);
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLSurfaceData.m	Fri Oct 31 12:38:46 2014 +0300
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLSurfaceData.m	Fri Oct 31 19:45:54 2014 +0300
@@ -187,6 +187,11 @@
     }
 
     OGLContext *oglc = cglInfo->context;
+    if (oglc == NULL) {
+        J2dRlsTraceLn(J2D_TRACE_ERROR, "OGLSD_SetScratchContext: ogl context is null");
+        return NULL;
+    }
+
     CGLCtxInfo *ctxinfo = (CGLCtxInfo *)oglc->ctxInfo;
 
 JNF_COCOA_ENTER(env);