Re: NSApplication Terminate:self <-- doesn't trigger dealloc method.
Re: NSApplication Terminate:self <-- doesn't trigger dealloc method.
- Subject: Re: NSApplication Terminate:self <-- doesn't trigger dealloc method.
- From: Ricky Sharp <email@hidden>
- Date: Wed, 17 May 2006 16:44:29 -0500
On May 17, 2006, at 4:30 PM, Frederick C. Lee wrote:
Greetings:
I have a [NSApp terminate:self]; method that I call within an
Exception handler. I noticed that the resident dealloc method
isn't fired.
Just to be safe, I would like the dealloc method to fire.
How do I trigger the resident dealloc method when I
programmatically terminate the program?
If your dealloc is only going to release memory-based objects and do
nothing else, then there's really no reason to call dealloc since the
app is going away.
However, if your object is doing crucial cleanup tasks, you could
refactor things a bit. Note that I'm now going to assume that the
object in question can become a singleton and that your main app
controller can hold a reference to that object. If so, you can
release that singleton object from within applicationWillTerminate:
What I do for my singletons is to implement a cleanup_II class-based
API. They are then all called from within applicationWillTerminate:
One could get a bit fancy and come up with a "cleanup" protocol and
have the app controller maintain a container of objects implementing
that protocol. Perhaps a "register" API could be used to build up
the container. Then, you'll simply iterate through that container
and call a well-known API to perform cleanup.
___________________________________________________________
Ricky A. Sharp mailto:email@hidden
Instant Interactive(tm) http://www.instantinteractive.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden