NSWindowController retain counts, chapter 2
NSWindowController retain counts, chapter 2
- Subject: NSWindowController retain counts, chapter 2
- From: James Walker <email@hidden>
- Date: Mon, 06 Oct 2008 15:57:51 -0700
After fixing things so that my NSWindowController subclass gets
deallocated, I discovered that the NSWindow was not getting deallocated.
It appears to be related to the fact that the NSWindow's retain count
is incremented each time -[NSWindowController window] is called. I don't
see anything in the documentation of the window method that would have
led me to expect that behavior. Is there some general principle I
should know about?
For now, I've worked around the problem by overriding the window method
as follows, where mWindow is a member variable:
- (NSWindow *)window
{
if (mWindow == nil)
{
mWindow = [super window];
}
return mWindow;
}
--
James W. Walker, Innoventive Software LLC
<http://www.frameforge3d.com/>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden