Re: Garbage collection and about windows
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