Re: Window Closing Behavior
Re: Window Closing Behavior
- Subject: Re: Window Closing Behavior
- From: Jim Hamilton <email@hidden>
- Date: Wed, 27 Jul 2005 11:06:49 -0400
On Jul 27, 2005, at 5:49 AM, John Nairn wrote:
[closing windows staying in windows lists]
I found the cause, but not the solution. In my application, the
data in the window might change requiring the window controller to
change the notifications it observes. When the data changes, I
remove it as an observer using
[[NSNotificationCenter defaultCenter] removeObserver:self];
Yikes!
and then create the new observations with several "addObserver"
calls. If I remove the "removeObserver" line, the window controller
is always removed and released correctly. If it is there, the
window controller releasing is messed up whenever a removeObserver
occurs between opening and closing the window.
That seems like overkill. Instead, you should probably send
-removeObserver:name:object:
for each of the notifications you added yourself. Check out <http://
developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/
ObjC_classic/Classes/NSWindow.html#//apple_ref/doc/uid/
20000013-105847-BCIEBJDE>; NSWindow sure sends a LOT of notifications
around...
Jim H
--
Jim Hamilton
email@hidden
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden