src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m

Print this page

        

@@ -43,10 +43,11 @@
 #include <signal.h>
 #include <unistd.h>
 #include <dlfcn.h>
 
 #include <sizecalc.h>
+#import "ThreadUtilities.h"
 
 static NSScreen* SplashNSScreen()
 {
     return [[NSScreen screens] objectAtIndex: 0];
 }

@@ -128,11 +129,15 @@
 char* SplashGetScaledImageName(const char* jar, const char* file,
                                float *scaleFactor) {
     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];
         NSRange range = [fileName rangeOfString: @"."