• 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
NSWindowController retain counts, chapter 2
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: NSWindowController retain counts, chapter 2
      • From: Graham Cox <email@hidden>
  • Prev by Date: Re: Problem setting the menu
  • Next by Date: Re: Data Types for Extracting samples from Audio Buffer: Resolved
  • Previous by thread: Re: Universal app fails on PPC.
  • Next by thread: Re: NSWindowController retain counts, chapter 2
  • Index(es):
    • Date
    • Thread