From a871d7a71ee3397f91ed4f9a385e15f95544cf84 Mon Sep 17 00:00:00 2001 From: anthony Date: Wed, 9 Oct 2013 15:34:53 +0400 Subject: [PATCH] 7159266: [macosx] ApplicationDelegate should not be set in the headless mode Summary: Don't install ApplicationDelegate in headless mode Reviewed-by: art, serb --- src/macosx/native/sun/awt/awt.m | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/macosx/native/sun/awt/awt.m b/src/macosx/native/sun/awt/awt.m index e730a5ca9..0a491fd44 100644 --- a/src/macosx/native/sun/awt/awt.m +++ b/src/macosx/native/sun/awt/awt.m @@ -312,15 +312,17 @@ AWT_ASSERT_APPKIT_THREAD; 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 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 delegate = [ApplicationDelegate sharedDelegate]; + if (delegate != nil) { + OSXAPP_SetApplicationDelegate(delegate); + } + }]; + } } - (void)starter:(NSArray*)args { -- GitLab