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 protected]>
To: [email protected]
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 protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/idou747%40yahoo.com

This email sent to [email protected]



      
__________________________________________________________________________________
Get more done like never before with Yahoo!7 Mail.
Learn more: http://au.overview.mail.yahoo.com/
_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to