changeset 10292:fb3f4212427f

8049198: [macosx] Incorrect thread access when showing splash screen Reviewed-by: serb, pchelko
author alexsch
date Fri, 11 Jul 2014 12:08:43 +0400
parents 0f61d05e28f1
children d75c27eecdfe
files src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m	Mon Jun 23 10:54:10 2014 -0700
+++ b/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];