Thank you Chris, Rob. I thought as much, but then I'm new to using GC. I thought that because I was able to access the window controller through the window that it was still reachable in the object graph. You know, like
[[aSampleView window] windowController];
Thought that meant there was a pointer already stored in the window instance, so unless the window was closed, it would not be collected. Thank you for clearing that up, I think I'll go with the global dictionary, as these window controller instances are created from several different places.

-B


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.


_______________________________________________

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