Re: what are the scenarios for an app to be terminated?
Re: what are the scenarios for an app to be terminated?
- Subject: Re: what are the scenarios for an app to be terminated?
- From: Seth Willits <email@hidden>
- Date: Wed, 6 Oct 2010 12:34:56 -0700
On Oct 6, 2010, at 12:13 PM, eveningnick eveningnick wrote:
> Now i am wondering, how can i correctly "release" myobject (i.e. make
> its -dealloc called)
You don't care if it gets deallocated. Really.
Snow Leopard supports "sudden termination" which means that it's possible that your application can *instantly* be terminated without a single method being called. This only happens if your process supports sudden termination (a plist option) and is in the "can suddenly terminate state" (determined by you). This means you don't want to rely on objects being deallocated before quit.
Even without sudden termination, many objects already aren't deallocated. I don't fully remember the process, but basically the app will check for unsaved windows, send the few delegate methods to resolve them, close them all, send a message to the app delegate, and if is all is well, it'll instantly terminate. Your app delegate, and some other top-level controllers won't be deallocated before the process exists because it's pointless.
So what you could care about is simply when the process is going to terminate so you can perform some last minute operation. (It's probably a better idea to not rely on doing it at the last minute, though.) To get the notification, you just watch for NSApplicationWillTerminateNotification to be sent (eg applicationWillTerminate: in your app delegate). You can do the details there. Anytime your application is quit, that will be called. Anytime your application is force-quit, it won't, but that's the point of force quitting.
--
Seth Willits
_______________________________________________
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