• 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
Problems with object observing own key
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problems with object observing own key


  • Subject: Problems with object observing own key
  • From: Colin Cornaby <email@hidden>
  • Date: Sun, 11 May 2008 13:36:03 -0700

I have an object that observes a few of it's own keys. This works fine. The problem comes at dealloc time...

I get messages logged to the console for each of the it's own keys that the object is observing like:

] An instance 0x1c247f50 of class GSLayerView is being deallocated while key value observers are still registered with it. Observation info is being leaked, and may even become mistakenly attached to some other object. Set a breakpoint on NSKVODeallocateBreak to stop here in the debugger. Here's the current observation info:
<NSKeyValueObservationInfo 0x1c2cd520> (
<NSKeyValueObservance 0x1c270340: Observer: 0x1c247f50, Key path: hasBackgroundColor, Options: <New: YES, Old: YES, Prior: NO> Context: 0x3281c, Property: 0x15f4df50>
...


I do remove the observers in my dealloc method, but it seems these warnings are being fired before my dealloc method is even called.

Are there any ways to fix my code to deal with this behavior?
_______________________________________________

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: Problems with object observing own key
      • From: "Hamish Allan" <email@hidden>
  • Prev by Date: Custom Font Chooser
  • Next by Date: Re: Cocoa string to carbon compatible C string
  • Previous by thread: Custom Font Chooser
  • Next by thread: Re: Problems with object observing own key
  • Index(es):
    • Date
    • Thread