diff --git a/src/macosx/native/sun/awt/awt.m b/src/macosx/native/sun/awt/awt.m index e730a5ca92050316534e57cdf2c63cc807311d31..0a491fd44f25aea91c46a2654725880362eb2559 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 {