Years-old mysterious bindings crash
Years-old mysterious bindings crash
- Subject: Years-old mysterious bindings crash
- From: Seth Willits <email@hidden>
- Date: Mon, 03 Oct 2011 18:29:39 -0700
I've been receiving reports of this rare but persistent crash over the past few years, and I've never been able to reproduce it or figure out what's causing it.
They often look exactly like the stack trace below, but sometimes it's different, happening at a different time. The thing they all have in common is it's a crash when notifying observers in a binding when loading a nib.
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000008000028
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Application Specific Information:
objc_msgSend() selector name: respondsToSelector:
objc_msgSend_vtable5 + 16
NSKeyValueNotifyObserver + 76
-[NSObject(NSKeyValueObservingPrivate) _notifyObserversForKeyPath:change:] + 991
-[NSController _notifyObserversForKeyPath:change:] + 218
-[NSObjectController setContent:] + 369
-[AQConnTabController awakeFromNib] + 976
-[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:] + 1515
-[NSNib instantiateNibWithExternalNameTable:] + 564
-[NSNib instantiateNibWithOwner:topLevelObjects:] + 233
-[NSViewController loadView] + 180
-[NSViewController view] + 38
-[AQConnTabController initWithNibName:bundle:windowController:] + 801
-[AQConnWindowController newTab:] + 56
-[NSWindowController _windowDidLoad] + 538
-[NSWindowController window] + 112
-[NSWindowController showWindow:] + 47
-[AQController newConnectionWindow:] + 72
-[AQController applicationOpenUntitledFile:] + 18
-[NSApplication _doOpenUntitled] + 211
-[NSApplication(NSAppleEventHandling) _handleCoreEvent:withReplyEvent:] + 101
-[NSAppleEventManager dispatchRawAppleEvent:withRawReply:handlerRefCon:] + 360
_NSAppleEventManagerGenericHandler + 114
aeDispatchAppleEvent(AEDesc const*, AEDesc*, unsigned int, unsigned char*) + 162
dispatchEventAndSendReply(AEDesc const*, AEDesc*) + 32
aeProcessAppleEvent + 210
AEProcessAppleEvent + 48
_DPSNextEvent + 1191
-[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 155
-[NSApplication run] + 395
NSApplicationMain + 364
start + 52
In this case [AQConnTabController awakeFromNib] calls setContent: on a object controller that AQConnTabController creates. The weird thing about that leading to a crash is that the object controller isn't hooked up to _anything_ yet. I'm certain it has nothing to do with that specific object controller. Other crashes have a similar trace at the top:
objc_msgSend_vtable5 + 24
NSKeyValueNotifyObserver + 61
-[NSObject(NSKeyValueObservingPrivate) _notifyObserversForKeyPath:change:] + 756
-[NSController _notifyObserversForKeyPath:change:] + 206
-[NSObjectController setContent:] + 395
-[NSObjectDetailBinder refreshDetailContent] + 230
-[NSObject(NSKeyValueBindingCreation) bind:toObject:withKeyPath:options:] + 591
-[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:] + 1079
-[NSNib instantiateNibWithExternalNameTable:] + 606
-[NSNib instantiateNibWithOwner:topLevelObjects:] + 251
-[NSViewController loadView] + 186
The thing they all have in common is that a nib is being loaded, which does some stuff with bindings, and then there's a crash. The bindings aren't even related in terms of what's connected to what.
What I believe is going on, is that somehow a deallocated object is still an observer somewhere, and at any point when the KVO system needs to notify somebody of any KVO message, it crashes when it tries to send a message to that deallocated object. The trouble is, I have _no_ clue how to find this. I've tried for endless hours over the years scouring my code for any whiff of something being done wrong and I've never found it. I swear the code everywhere I've looked is fine, the analyzer doesn't point out any mistakes, Valgrind is fine, I'm confident I don't have any memory smashers etc.... What can I do to figure this out? Anybody have any tricky ideas?
I'm hoping somebody has seen this stack trace before and knows what kind of subtle bug causes it. :\
Thanks,
--
Seth Willits
_______________________________________________
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