7159266: [macosx] ApplicationDelegate should not be set in the headless mode
authoranthony
Wed, 09 Oct 2013 15:34:53 +0400
changeset 21241 dc8cd488885d
parent 21240 fca30a64f6ed
child 21242 dd191df75e13
7159266: [macosx] ApplicationDelegate should not be set in the headless mode Summary: Don't install ApplicationDelegate in headless mode Reviewed-by: art, serb
jdk/src/macosx/native/sun/awt/awt.m
--- a/jdk/src/macosx/native/sun/awt/awt.m	Wed Oct 09 14:12:40 2013 +0400
+++ b/jdk/src/macosx/native/sun/awt/awt.m	Wed Oct 09 15:34:53 2013 +0400
@@ -312,15 +312,17 @@
         if (verbose) AWT_DEBUG_LOG(@"got out of the AppKit startup mutex");
     }
 
-    // Don't set the delegate until the NSApplication has been created and
-    // its finishLaunching has initialized it.
-    //  ApplicationDelegate is the support code for com.apple.eawt.
-    [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
-        id<NSApplicationDelegate> delegate = [ApplicationDelegate sharedDelegate];
-        if (delegate != nil) {
-            OSXAPP_SetApplicationDelegate(delegate);
-        }        
-    }];
+    if (!headless) {
+        // Don't set the delegate until the NSApplication has been created and
+        // its finishLaunching has initialized it.
+        //  ApplicationDelegate is the support code for com.apple.eawt.
+        [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
+            id<NSApplicationDelegate> delegate = [ApplicationDelegate sharedDelegate];
+            if (delegate != nil) {
+                OSXAPP_SetApplicationDelegate(delegate);
+            }        
+        }];
+    }
 }
 
 - (void)starter:(NSArray*)args {