Re: returning NO from readFromFile:ofType: causes exception
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