• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Cleanup inside a failed init method
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Cleanup inside a failed init method (From: Ken Tozier <email@hidden>)
 >Re: Cleanup inside a failed init method (From: Charles Steinman <email@hidden>)
 >Re: Cleanup inside a failed init method (From: "Adam R. Maxwell" <email@hidden>)

  • Prev by Date: Re: Reading in XML with iso-8859-1 encoding?
  • Next by Date: Re: Cleanup inside a failed init method
  • Previous by thread: Re: Cleanup inside a failed init method
  • Next by thread: Re: Cleanup inside a failed init method
  • Index(es):
    • Date
    • Thread