Re: Problem with an NSWindowController's retain count
Re: Problem with an NSWindowController's retain count
- Subject: Re: Problem with an NSWindowController's retain count
- From: Ben Kazez <email@hidden>
- Date: Tue, 19 Jul 2005 22:11:45 -0400
On Jul 19, 2005, at 4:40 PM, Will Mason wrote:
Here's my -[WSAppDelegate viewerWindowControllers] method:
- (NSMutableArray *)viewerWindowControllers {
if (viewerWindowControllers == nil) {
viewerWindowControllers = [[NSMutableArray alloc] init];
}
return [viewerWindowControllers autorelease];
}
This is your problem. The last line of this method should either be:
return viewerWindowControllers;
Or:
return [[viewerWindowControllers retain] autorelease];
You're overreleasing it.
Good luck,
Will
Works perfectly! And now I understand Cocoa memory management better.
Sorry to bother the list with what amounted to another basic Cocoa
memory management question.
Ben
_______________________________________________
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