• 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: returning NO from readFromFile:ofType: causes exception
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: returning NO from readFromFile:ofType: causes exception


  • Subject: Re: returning NO from readFromFile:ofType: causes exception
  • From: Frank Midgley <email@hidden>
  • Date: Fri, 18 Feb 2005 18:21:51 -0600

On Feb 18, 2005, at 4:32PM, Robert Clair wrote:

Sorry to reply to my own post, but a bit more information:

my document subclass overrides initWithContentsOfFile:ofType:  -


- (id)initWithContentsOfFile:(NSString *)fileName ofType:(NSString *)docType
{
[super initWithContentsOfFile: fileName ofType: docType];


  if (self )
    {
         // custom stuff
    }
  return self;
}

I'm not sure if it's the root cause here but you always need to do self = [super init...]. The call to super may actually dealloc the original self and return a new instance. If you return the original self in that case and someone else tries to use it they will crash.


-Frank

------------------------------------
Frank M. Midgley
email@hidden
http://homepage.mac.com/knarf/

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: returning NO from readFromFile:ofType: causes exception
      • From: Robert Clair <email@hidden>
References: 
 >returning NO from readFromFile:ofType: causes exception (From: Robert Clair <email@hidden>)
 >Re: returning NO from readFromFile:ofType: causes exception (From: Robert Clair <email@hidden>)

  • Prev by Date: Re: Preventing mouse clicks from bringing a window to the front
  • Next by Date: Re: Listening to bindings
  • Previous by thread: Re: returning NO from readFromFile:ofType: causes exception
  • Next by thread: Re: returning NO from readFromFile:ofType: causes exception
  • Index(es):
    • Date
    • Thread