• 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: 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


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: Jens Bauer <email@hidden>)
 >Re: Cleanup inside a failed init method (From: Charles Steinman <email@hidden>)

  • Prev by Date: File Sharing Within App
  • Next by Date: Re: core data, refreshObject, multiple threads
  • Previous by thread: Re: Cleanup inside a failed init method
  • Next by thread: Re: Cleanup inside a failed init method
  • Index(es):
    • Date
    • Thread