• 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
On more newbie question about init...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

On more newbie question about init...


  • Subject: On more newbie question about init...
  • From: Scott Andrew <email@hidden>
  • Date: Fri, 13 Jun 2003 20:16:04 -0700

I am writing my own -initWithFileContents for my objects. The base class does nothing but store the file name they were loaded from. But for my image class I have the following:

-(id)initWithFileContents:(NSString*) filePath
{
if (self = [super initWithFileContents:filePath])
{
image = [[NSImage alloc] initWithContentsOfFile:filePath];

if (image == nil)
{
[self release];
return nil;
}
}

return self;
}

Is it OK to call release on self like this to fail out of the imbedded object doesn't create?

Scott Andrew
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: On more newbie question about init...
      • From: Wade Tregaskis <email@hidden>
    • Re: On more newbie question about init...
      • From: Andrew Pinski <email@hidden>
  • Prev by Date: Re: The more I read about MVC, the more confused I get...
  • Next by Date: Re: NSApplication delegate not released on quit?
  • Previous by thread: Re: NSApplication delegate not released on quit?
  • Next by thread: Re: On more newbie question about init...
  • Index(es):
    • Date
    • Thread