Problems with object observing own key
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