Re: Is Apple's singleton sample code correct?
Re: Is Apple's singleton sample code correct?
- Subject: Re: Is Apple's singleton sample code correct?
- From: Uli Kusterer <email@hidden>
- Date: Tue, 29 Nov 2005 17:50:10 +0100
Am 29.11.2005 um 16:02 schrieb Darkshadow:
-dealloc is not guaranteed to be called when the application is
quitting. So if you have resources (other than memory) that need
to be cleaned up, you should really listen for the -
applicationWillTerminate: notification and do the clean up there.
This one bit me when I was first starting to learn Cocoa - I had a
temp file written to disk that I wanted removed when the
application quit. I put the removal in the -dealloc method. It
took me a while to figure out that the file wasn't being removed
because -dealloc wasn't being called (on this particular object)
when the application quit.
Correction: -dealloc of objects in Main.nib doesn't get called when
your app quits. If you have an NSDocument, that will usually be saved
and dealloced just fine.
Cheers,
-- M. Uli Kusterer
http://www.zathras.de
_______________________________________________
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