• 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
Re: NSWindowController and GC
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSWindowController and GC


  • Subject: Re: NSWindowController and GC
  • From: Chris Idou <email@hidden>
  • Date: Wed, 30 Sep 2009 18:08:58 -0700 (PDT)


The right way is to make sure something in your program retains a pointer to your window controller. Sometimes there will be an obvious place, like a member of the object that created the window controller. That is most typical. Worst case is you retain a pointer in some global variable or similar, but that also has a greater danger that you will forget to zero it out when you are finished with it, and it won't get collected. Some of my temporary dialog box controllers inherit from a class that puts itself in a global dictionary when created, and removes itself when the window closes.




________________________________
From: Bryan Matteson <email@hidden>
To: email@hidden
Sent: Thursday, 1 October, 2009 9:20:16 AM
Subject: NSWindowController and GC

I was just reminded of something. I use GC in my app, and unless I specifically disable collection for a window controller, it's destroyed as soon as it loses key. I solved it by setting the controller as the delegate of the window, disabling collection for the window controller in windowDidLoad, and re-enabling it in windowWillClose:. Is there another way?

-B
_______________________________________________

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



      __________________________________________________________________________________
Get more done like never before with Yahoo!7 Mail.
Learn more: http://au.overview.mail.yahoo.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 and GC
      • From: Bryan Matteson <email@hidden>
References: 
 >NSWindowController and GC (From: Bryan Matteson <email@hidden>)

  • Prev by Date: NSDocumentController didCloseAllSelector
  • Next by Date: Re: NSDocumentController didCloseAllSelector
  • Previous by thread: Re: NSWindowController and GC
  • Next by thread: Re: NSWindowController and GC
  • Index(es):
    • Date
    • Thread