• 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: How to de-register value observers
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to de-register value observers


  • Subject: Re: How to de-register value observers
  • From: Tron Thomas <email@hidden>
  • Date: Mon, 03 Sep 2007 11:29:33 -0700

Nick Zitzmann wrote:

On Aug 29, 2007, at 8:54 AM, Tron Thomas wrote:

An instance 0x30fda0 of class <My Window Controller Class> is being deallocated while key value observers are still registered with it. Break on _NSKVODeallocateLog to start debugging.

I'm assuming this message indicates a problem with the implementation for my window controller class, and I would like to eliminate that problem. What is needed to prevent this message from occurring?

<file:///Developer/ADC Reference Library/documentation/Cocoa/Reference/Foundation/Protocols/NSKeyValueObserving_Protocol/Reference/Reference.html#//apple_ref/occ/instm/NSObject/removeObserver:forKeyPath:>



Nick Zitzmann <http://www.chronosnet.com/>
removeObserver:forKeyPath: is the equivalent for addObserver:forKeyPath:options:context, which is call by the object that wants to observe the value.

Since the observing object registers itself, it seems that the same object should de-register itself as well. I'm not sure how every registered object is supposed to know that the window controller is deallocating itself so they can de-register themselves.

If the window controller should de-register the observers instead. I'm not sure how it is supposed to know about all its observers. I can't find a method that will provide that kind of information. It seems that the window controller would have to override addObserver:forKeyPath:options:context so it can perform the task of tracking the registered observers, even though the super class is doing that already.

How is all this de-registration supposed to work?

_______________________________________________

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


  • Follow-Ups:
    • Re: How to de-register value observers
      • From: Nick Zitzmann <email@hidden>
References: 
 >How to de-register value observers (From: Tron Thomas <email@hidden>)
 >Re: How to de-register value observers (From: Nick Zitzmann <email@hidden>)

  • Prev by Date: Re: check if a file path is useable
  • Next by Date: Re: How to de-register value observers
  • Previous by thread: Re: How to de-register value observers
  • Next by thread: Re: How to de-register value observers
  • Index(es):
    • Date
    • Thread