Re: some crash i can not explain.
Re: some crash i can not explain.
- Subject: Re: some crash i can not explain.
- From: Nick Zitzmann <email@hidden>
- Date: Mon, 23 Oct 2006 12:29:00 -0600
On Oct 23, 2006, at 12:15 PM, Sandro Noel wrote:
- (oneway void) release{
[displayString release]; // i have a retain on it.
}
Don't ever do this. Not only does the above not invoke the superclass
implementation (it should) but you should override -dealloc instead.
In general there are few reasons to override -release, -retain, or -
autorelease in subclasses.
-(void)setDisplayString:(NSString *)value{
// retain the string so it does not go away...
displayString = [value retain];
}
This will cause a memory leak if displayString was set to something
else. Try this instead:
if (value != displayString)
{
[displayString release];
displayString = [value retain];
}
Nick Zitzmann
<http://www.chronosnet.com/>
_______________________________________________
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