Re: Cleanup inside a failed init method
Re: Cleanup inside a failed init method
- Subject: Re: Cleanup inside a failed init method
- From: Jens Bauer <email@hidden>
- Date: Sun, 7 Dec 2008 09:59:08 +0100
Hi Chuck,
On Dec 7, 2008, at 03:00, Charles Steinman wrote:
I'm sorry, I think I misunderstood the following line (due to the way
we say things in Danish):
Happily, the object should be released anyway if you plan to
return nil since
otherwise you'll leak a half-initialized object every time the
method fails.
-I'm actually trying to say the same thing: self should be deallocated/
released.
So you should release self and return nil.
-Exactly!
self=NULL;
...should automatically deallocate the object, and I've never heard
that it did.
I don't know why you think the object would be dealloced between
alloc and init. If the if(self) conditional evaluates to nil, that's
because [super init] returned nil.
Sorry for the noise. =)
Love,
Jens
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden