Re: Cleanup inside a failed init method
Re: Cleanup inside a failed init method
- Subject: Re: Cleanup inside a failed init method
- From: "Michael Ash" <email@hidden>
- Date: Sat, 6 Dec 2008 20:53:16 -0500
On Sat, Dec 6, 2008 at 4:53 PM, Adam R. Maxwell <email@hidden> wrote:
> I used the [self release] pattern for a long time, but this thread indicates
> that you should clean up in the initializer, then call [super dealloc]
> directly:
>
> http://lists.apple.com/archives/objc-language/2008//Sep/msg00133.html
Wouldn't this fail horribly if your superclass had done something
unusual but perfectly legal such as [[self retain] autorelease]?
Forcing your subclasses to implement -dealloc methods which can
withstand being invoked on an uninitialized object (which, recall, is
not terribly hard since its instance variables will be zero-filled)
seems like a much better way to go.
Mike
_______________________________________________
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