Re: NSApplication delegate not released on quit?
Re: NSApplication delegate not released on quit?
- Subject: Re: NSApplication delegate not released on quit?
- From: Marco Scheurer <email@hidden>
- Date: Sat, 14 Jun 2003 16:03:01 +0200
On Saturday, June 14, 2003, at 07:42 AM, Hsu wrote:
So all your singleton objects should register themselves to the
NSApplicationWillTerminateNotification to free themselves? Or a
message should be sent to classes to do it? I'm pretty sure there are
more interesting and useful things to do in your code than that. I
don't see why admitting that some "immortal" objects live until the
application dies is such a big deal. Think of it as another kind of
contract, and you're done.
This is great until you decide to use that object somewhere else, for
some other reason, and then it starts leaking...
I did not say that the class that implement a singleton object should
not have a proper dealloc method, I said that you should not have to
care about releasing singleton objects, and certainly not before
quitting. Obviously, if you're going to allocate other objects of this
class you should retain and release correctly.
The "bug" described in the original post was that the application does
not release its delegate. This has nothing to do with the delegate
class having or not a correct dealloc method, nor about how many
instance of this class have been allocated during the lifetime of the
application.
Marco Scheurer
Sen:te, Lausanne, Switzerland
http://www.sente.ch
_______________________________________________
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.