changeset 5211:24a9125a2c96

7159266: [macosx] ApplicationDelegate should not be set in the headless mode Summary: Don't install an application delegate in headless mode Reviewed-by: swingler, snorthov, skovatch
author anthony
date Mon, 09 Apr 2012 16:21:33 +0400
parents 40084a75a36f
children 1a495432b42a
files src/macosx/native/sun/awt/awt.m
diffstat 1 files changed, 12 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/macosx/native/sun/awt/awt.m	Sat Apr 07 12:46:32 2012 +0400
+++ b/src/macosx/native/sun/awt/awt.m	Mon Apr 09 16:21:33 2012 +0400
@@ -307,16 +307,18 @@
         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.
-    void (^setDelegateBlock)() = ^(){
-        OSXAPP_SetApplicationDelegate([ApplicationDelegate sharedDelegate]);
-    };
-    if (onMainThread) {
-        setDelegateBlock();
-    } else {
-        [JNFRunLoop performOnMainThreadWaiting:YES withBlock:setDelegateBlock];
+    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.
+        void (^setDelegateBlock)() = ^(){
+            OSXAPP_SetApplicationDelegate([ApplicationDelegate sharedDelegate]);
+        };
+        if (onMainThread) {
+            setDelegateBlock();
+        } else {
+            [JNFRunLoop performOnMainThreadWaiting:YES withBlock:setDelegateBlock];
+        }
     }
 }