7159266: [macosx] ApplicationDelegate should not be set in the headless mode
Summary: Don't install ApplicationDelegate in headless mode
Reviewed-by: art, serb
--- a/jdk/src/macosx/native/sun/awt/awt.m Wed Oct 09 14:12:40 2013 +0400
+++ b/jdk/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 {