8039926: -spash:<image> can't be combined with -xStartOnFirstThread since JDK 7
authorpchelko
Thu, 17 Apr 2014 16:26:45 +0400
changeset 24190 bbd2288a8a29
parent 24189 8c66c46f2ebb
child 24191 75ee64f51cb4
8039926: -spash:<image> can't be combined with -xStartOnFirstThread since JDK 7 Reviewed-by: anthony, azvegint
jdk/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m
--- a/jdk/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m	Wed Apr 16 12:42:40 2014 -0700
+++ b/jdk/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m	Thu Apr 17 16:26:45 2014 +0400
@@ -142,9 +142,16 @@
     splash->screenFormat.byteOrder = 1 ?  BYTE_ORDER_LSBFIRST : BYTE_ORDER_MSBFIRST;
     splash->screenFormat.depthBytes = 4;
 
-    [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^() {
-        [NSApplicationAWT runAWTLoopWithApp:[NSApplicationAWT sharedApplication]];
-    }];
+    // If this property is present we are running SWT and should not start a runLoop
+    // Can't check if running SWT in webstart, so splash screen in webstart SWT
+    // applications is not supported
+    char envVar[80];
+    snprintf(envVar, sizeof(envVar), "JAVA_STARTED_ON_FIRST_THREAD_%d", getpid());
+    if (getenv(envVar) == NULL) {
+        [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^() {
+            [NSApplicationAWT runAWTLoopWithApp:[NSApplicationAWT sharedApplication]];
+        }];
+    }
 }
 
 void