Re: cmd-q versus menu item quit
Re: cmd-q versus menu item quit
- Subject: Re: cmd-q versus menu item quit
- From: Nick Zitzmann <email@hidden>
- Date: Tue, 11 May 2004 15:41:33 -0600
On May 11, 2004, at 2:39 PM, Milton Sagen wrote:
The simplest explanation is to say that I have a temporary file that
an object in the window deletes when its dealloc'd. The object is
dealloc'd when the user quits with the cmd-q but not when quitting via
the menu item, hence in the former case the file is removed but not
in the latter.
Stiphane is correct; in general -dealloc methods should just release
any member objects and disconnect itself from the rest of the
application (if it observes notifications, etc.). Instead of doing what
you're doing, you ought to make your object(s) listen for
NSApplicationWillTerminateNotification and then do the cleanup in the
observer for that notification.
Likewise, if this event is also supposed to trigger when a window is
closed, then you ought to give your window a delegate and implement
NSWindow's -windowWillClose: delegate.
Nick Zitzmann
<
http://www.chronosnet.com/>
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.