Binding to a released object results in crash - how do find the observer?
Binding to a released object results in crash - how do find the observer?
- Subject: Binding to a released object results in crash - how do find the observer?
- From: David Hoerl <email@hidden>
- Date: Tue, 23 Feb 2010 20:25:04 -0500
I had an issue (since resolved) where an object set a property to nil
directly, without providing KVO notification. Later, the app crashed:
Running with debug and Zombies enabled got me here:
-[NSKeyValueObservance retain]: message sent to deallocated instance
In the end, I discovered that if I used self.ivar = nil, the crash went
away - but I only found this by blind luck. Seems that a button
somewhere was bound to a property through an object that was dealloc'd.
My question is this: how does one debug such issues? I enabled Zombies,
turned on all the Zombie related breakpoints, enabled the binding log
level, exception raise (on and off), etc. What would have REALLY helped
is knowing WHAT the property name of the binding was.
So, that's really the question - what is the **proper** way to discover
the culprit in such situations? How do you find out even the keyPath of
the binding?
Thanks,
David
--------
Crash with Release configuration:
#0 0x905faee4 in objc_msgSend
#1 0x16e253d0 in ??
#2 0x90e80802 in NSKeyValuePushPendingNotificationPerThread
#3 0x90e80198 in NSKeyValueWillChange
#4 0x90f61876 in -[NSObject(NSKeyValueObservingPrivate)
_willChangeValuesForKeys:]
#5 0x95e5f8c1 in -[NSFaultHandler turnObject:intoFaultWithContext:]
#6 0x95e733b8 in -[NSManagedObjectContext(_NSInternalAdditions)
_disposeObjects:count:notifyParent:]
#7 0x95e72baf in -[NSManagedObjectContext(_NSInternalAdditions) _dispose:]
#8 0x95e726ba in -[NSManagedObjectContext dealloc]
#9 0x95e5f5ca in -[NSManagedObjectContext release]
#10 0x945a4839 in -[NSPersistentDocument setManagedObjectContext:]
#11 0x945a4b41 in -[NSPersistentDocument dealloc]
#12 0x0006df1c in -[ZZInterfaceDocument dealloc] at
ZZInterfaceDocument.m:211
#13 0x000ad5be in -[ZZInspectorController setInterface:] at
ZZInspectorController.m:56
#14 0x000a7b07 in -[ZZInspectorController dealloc] at
ZZInspectorController.m:170
#15 0x9416eacd in -[NSWindowController release]
#16 0x90e9ae64 in __performTimerCleanup
#17 0x9395ae2b in CFRunLoopObserverInvalidate
#18 0x939569c3 in __CFRunLoopDoObservers
#19 0x9391318d in __CFRunLoopRun
#20 0x93912864 in CFRunLoopRunSpecific
#21 0x93912691 in CFRunLoopRunInMode
#22 0x94dbef0c in RunCurrentEventLoopInMode
#23 0x94dbebff in ReceiveNextEventCommon
#24 0x94dbeb48 in BlockUntilNextEventMatchingListInMode
#25 0x940ebac5 in _DPSNextEvent
#26 0x940eb306 in -[NSApplication
nextEventMatchingMask:untilDate:inMode:dequeue:]
#27 0x940ad49f in -[NSApplication run]
#28 0x940a5535 in NSApplicationMain
#29 0x00002f36 in start at iostream:76
_______________________________________________
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