• 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: Garbage collection and about windows
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Garbage collection and about windows


  • Subject: Re: Garbage collection and about windows
  • From: Bill Bumgarner <email@hidden>
  • Date: Tue, 08 Sep 2009 20:19:58 -0700

On Sep 8, 2009, at 6:45 PM, Ben Haller wrote:

My idea — perhaps being too clever for my own good — was that as long as the about window was open, the window would be referenced by the window list, and so the window and its controller would stick around. Choosing the "About" menu item a second time would therefore just call showWindow: on the controller again, ordering the window to the front if it had gotten buried. As soon as the window was closed, I figured it and its controller would be garbage collected, and the weak reference to it in the app delegate would zero out, so then choosing "About" would create a new controller and reload the nib.

Panels -- NSPanel subclasses -- don't show up in the window list (and aren't visible in the Windows menu on the menu bar, either) and, thus, you'll see the behavior you do.


Unless your about panel is ridiculously large & complex, make the aboutController __strong and forget about it. It'll only take up memory if a user brings it up -- which will be rare -- and, once that happens, the memory is minimal.

b.bum

_______________________________________________

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


References: 
 >Garbage collection and about windows (From: Ben Haller <email@hidden>)

  • Prev by Date: Re: Malloc error: GC operation on unregistered thread...
  • Next by Date: NSArray EXEC_BAD_ACCESS when initalized with strings
  • Previous by thread: Garbage collection and about windows
  • Next by thread: How to set the media box for a CGPDFPageRef?
  • Index(es):
    • Date
    • Thread