• 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: Window Closing Behavior
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Re: Window Closing Behavior (From: John Nairn <email@hidden>)

  • Prev by Date: Re: How do you use AuthorizationRuleIsAdmin?
  • Next by Date: Re: Icon question
  • Previous by thread: Re: Window Closing Behavior
  • Next by thread: Re: Performance issue : NSDictionary against NSXMLNode and NSXMLParser
  • Index(es):
    • Date
    • Thread