Re: Very Simple Demo: Modal Dialog causes later Modal Session to Crash
Re: Very Simple Demo: Modal Dialog causes later Modal Session to Crash
- Subject: Re: Very Simple Demo: Modal Dialog causes later Modal Session to Crash
- From: Kyle Sluder <email@hidden>
- Date: Wed, 15 Sep 2010 18:58:20 -0700
On Wed, Sep 15, 2010 at 6:07 PM, Jerry Krinock <email@hidden> wrote:
> - (void)applicationWillFinishLaunching:(NSNotification*)aNotification {
> NSRunAlertPanel(@"Hello",
> @"A crash is coming soon.",
> @"OK",
> nil,
> nil) ;
> }
There's no runloop running yet when -applicationWillFinishLaunching:
is called. You can see this for yourself by installing a
CFRunLoopObserver in main(), before calling NSApplicationMain. As
such, this is a very sensitive point in the app's life cycle. Among
other things, AppKit's automatically-installed autorelease pool hasn't
been installed yet (which you can verify by putting a call to the
undocumented NSPopAutoreleasePool function in
-applicationWillFinishLaunching:). That's why you're getting all the
autorelease pool warnings on the console.
Then NSRunAlertPanel is going to run the app in a modal mode before
the app has finished setting itself up. I'm not surprised that doesn't
work.
What is there that you can't do in -applicationDidFinishLaunching:?
--Kyle Sluder
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden