Re: Newbie question: autorelease sends autorelease
Re: Newbie question: autorelease sends autorelease
- Subject: Re: Newbie question: autorelease sends autorelease
- From: j o a r <email@hidden>
- Date: Wed, 22 Sep 2004 08:41:09 +0200
On 2004-09-22, at 08.24, Chris Ridd wrote:
That's a good question, but I can't see any reason why a dealloc method
would ever autorelease something in the first place. There's no point -
autorelease is only useful if you're returning an object to someone
else,
and by definition dealloc doesn't do that.
This is not true. The ability to autorelease objects can be useful also
in cases where you're not returning objects. Take for example the case
with the self contained window controller that should be released after
it's window is closed. It's customary to autorelease it on
"windowWillClose:". Autorelease is also often used in place of release
to be able to alloc-init-autorelease on one single row - in order to
create code that's easier to understand, and therefore maintain.
j o a r
_______________________________________________
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