8049198: [macosx] Incorrect thread access when showing splash screen
authoralexsch
Fri, 11 Jul 2014 12:08:43 +0400
changeset 25769 f18107faec8f
parent 25768 b10ec9701a7e
child 25770 d132697706ea
8049198: [macosx] Incorrect thread access when showing splash screen Reviewed-by: serb, pchelko
jdk/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m
--- a/jdk/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m	Mon Jun 23 10:54:10 2014 -0700
+++ b/jdk/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m	Fri Jul 11 12:08:43 2014 +0400
@@ -45,6 +45,7 @@
 #include <dlfcn.h>
 
 #include <sizecalc.h>
+#import "ThreadUtilities.h"
 
 static NSScreen* SplashNSScreen()
 {
@@ -130,8 +131,12 @@
     NSAutoreleasePool *pool = [NSAutoreleasePool new];
     *scaleFactor = 1;
     char* scaledFile = nil;
-    float screenScaleFactor = [SplashNSScreen() backingScaleFactor];
-    
+    __block float screenScaleFactor = 1;
+
+    [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
+        screenScaleFactor = [SplashNSScreen() backingScaleFactor];
+    }];
+
     if (screenScaleFactor > 1) {
         NSString *fileName = [NSString stringWithUTF8String: file];
         NSUInteger length = [fileName length];