diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CGraphicsEnv.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CGraphicsEnv.m index 745569452d6..1c3baf40dde 100644 --- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CGraphicsEnv.m +++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CGraphicsEnv.m @@ -26,6 +26,7 @@ #import "AWT_debug.h" #import "jni_util.h" +#import "ThreadUtilities.h" #import @@ -114,17 +115,20 @@ static void displaycb_handle { if (flags == kCGDisplayBeginConfigurationFlag) return; - JNFPerformEnvBlock(JNFThreadDetachImmediately, ^(JNIEnv *env) { - JNFWeakJObjectWrapper *wrapper = (JNFWeakJObjectWrapper *)userInfo; + [ThreadUtilities performOnMainThreadWaiting:NO block:^() { - jobject graphicsEnv = [wrapper jObjectWithEnv:env]; - if (graphicsEnv == NULL) return; // ref already GC'd - static JNF_CLASS_CACHE(jc_CGraphicsEnvironment, "sun/awt/CGraphicsEnvironment"); - static JNF_MEMBER_CACHE(jm_displayReconfiguration, jc_CGraphicsEnvironment, "_displayReconfiguration", "(IZ)V"); - JNFCallVoidMethod(env, graphicsEnv, jm_displayReconfiguration, - (jint) display, - (jboolean) flags & kCGDisplayRemoveFlag); - }); + JNFPerformEnvBlock(JNFThreadDetachImmediately, ^(JNIEnv *env) { + JNFWeakJObjectWrapper *wrapper = (JNFWeakJObjectWrapper *)userInfo; + + jobject graphicsEnv = [wrapper jObjectWithEnv:env]; + if (graphicsEnv == NULL) return; // ref already GC'd + static JNF_CLASS_CACHE(jc_CGraphicsEnvironment, "sun/awt/CGraphicsEnvironment"); + static JNF_MEMBER_CACHE(jm_displayReconfiguration, + jc_CGraphicsEnvironment, "_displayReconfiguration","(IZ)V"); + JNFCallVoidMethod(env, graphicsEnv, jm_displayReconfiguration, + (jint) display, (jboolean) flags & kCGDisplayRemoveFlag); + }); + }]; } /* diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLGraphicsConfig.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLGraphicsConfig.m index 605c345f2ce..775b92f5b2b 100644 --- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLGraphicsConfig.m +++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLGraphicsConfig.m @@ -233,6 +233,7 @@ Java_sun_java2d_opengl_CGLGraphicsConfig_getCGLConfigInfo } NSOpenGLPixelFormatAttribute attrs[] = { + NSOpenGLPFAAllowOfflineRenderers, NSOpenGLPFAClosestPolicy, NSOpenGLPFAWindow, NSOpenGLPFAPixelBuffer,