KVO strangeness under 10.5
KVO strangeness under 10.5
- Subject: KVO strangeness under 10.5
- From: Sean Todd <email@hidden>
- Date: Sat, 12 Apr 2008 16:59:39 -0500
I have a Cocoa document app that uses bindings. After installing 10.5
and Xcode 3.0, I started seeing console output stating that objects
were being deallocated while observers are still registered with them.
After some investigation, I found that the objects being deallocated
had an extra observer that I never registered (see the final
observance instance listed in the -observationInfo output below:
(gdb) po [theItem observationInfo]
<NSKeyValueObservationInfo 0x1e3880> (
<NSKeyValueObservance 0x19e5a0: Observer: 0x18ea60, Key path: name,
Options: <New: NO, Old: YES, Prior: NO> Context: 0x0, Property:
0x19e5c0>
<NSKeyValueObservance 0x1a3ca0: Observer: 0x18ea60, Key path:
category, Options: <New: NO, Old: YES, Prior: NO> Context: 0x0,
Property: 0x1a3c80>
<NSKeyValueObservance 0x1ce8b0: Observer: 0x18ea60, Key path: grade,
Options: <New: YES, Old: YES, Prior: NO> Context: 0x0, Property:
0x192920>
<NSKeyValueObservance 0x1ceb50: Observer: 0x18ea60, Key path:
isDropped, Options: <New: NO, Old: YES, Prior: NO> Context: 0x0,
Property: 0x1a3cd0>
<NSKeyValueObservance 0x192340: Observer: 0x193060, Key path: grade,
Options: <New: NO, Old: YES, Prior: NO> Context: 0x0, Property:
0x192920>
<NSKeyValueObservance 0x65046c0: Observer: 0x6503f00, Key path: grade,
Options: <New: NO, Old: NO, Prior: NO> Context: 0x18ea60, Property:
0x192920>
)
I have no idea what sort of object 0x6503f00 is or how/when it was
registered. Looking at the address in memory did not give me any
clues. The one interesting bit of info is that the address listed with
its Context is the same as the first 4 observers.
Continuing on predictably leads to the console output:
2008-04-12 16:18:20.760 MyApp[329:813] An instance 0x1c3d40 of class
Assignment 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 0x1b3970> (
<NSKeyValueObservance 0x6503f20: Observer: 0x6503f00, Key path: grade,
Options: <New: NO, Old: NO, Prior: NO> Context: 0x1c3ce0, Property:
0x192920>
)
When I debug this app with Xcode 2.4 on 10.4.x, there are no extra
observers and everything works well.
I did not see anything addressing this issue in the foundation release
notes. Nor have I found any discussion of this problem in the
archives. Am I missing something? Do I need to file a bug? Any help
would be appreciated.
_______________________________________________
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