src/macosx/native/sun/awt/awt.m

Print this page

        

*** 304,313 **** --- 304,325 ---- pthread_mutex_unlock(&sAppKitStarted_mutex); // AWT gets here AFTER +[AWTStarter appKitIsRunning:] is called. 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]; + } } - (void)starter:(NSArray*)args { NSAutoreleasePool *pool = [NSAutoreleasePool new];
*** 338,351 **** // already a NSApplication instance. If there is already a NSApplication instance, // and -[NSApplication isRunning] returns YES, AWT is embedded inside another // AppKit Application. NSApplication *app = [NSApplicationAWT sharedApplication]; - // Don't set the delegate until the NSApplication has been created. - // ApplicationDelegate is the support code for com.apple.eawt. - OSXAPP_SetApplicationDelegate([ApplicationDelegate sharedDelegate]); - // AWT gets to this point BEFORE NSApplicationDidFinishLaunchingNotification is sent. if (![app isRunning]) { if (verbose) AWT_DEBUG_LOG(@"+[AWTStarter startAWT]: ![app isRunning]"); // This is where the AWT AppKit thread parks itself to process events. --- 350,359 ----