changeset 10450:929dc0915f8c

7159266: [macosx] ApplicationDelegate should not be set in the headless mode Summary: Don't install ApplicationDelegate in headless mode Reviewed-by: art, serb
author anthony
date Wed, 09 Oct 2013 15:34:53 +0400
parents 84c766f6796b
children 976e5f580124
files src/macosx/native/sun/awt/awt.m
diffstat 1 files changed, 11 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/macosx/native/sun/awt/awt.m	Wed Oct 09 14:12:40 2013 +0400
+++ b/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 {