From 8b7ad3288c14a7e109e2f24843d23c6a609c8083 Mon Sep 17 00:00:00 2001 From: Anthony Petrov Date: Wed, 9 Oct 2013 15:34:53 +0400 Subject: [PATCH] 7159266: [macosx] ApplicationDelegate should not be set in the headless mode Don't install ApplicationDelegate in headless mode Reviewed-by: art, serb --- jdk/src/macosx/native/sun/awt/awt.m | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/jdk/src/macosx/native/sun/awt/awt.m b/jdk/src/macosx/native/sun/awt/awt.m index e730a5ca920..0a491fd44f2 100644 --- a/jdk/src/macosx/native/sun/awt/awt.m +++ b/jdk/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 {