I have an NSTextField which is bound to an int in an object that I have included in my nib. When the object changes its int, the text field follows suit, and everything looks fine.
However, when I try to change it manually the program crashes as soon as I hit a key. It's not even getting into my setter methods, it just crashes with
Program received signal: “EXC_BAD_ACCESS”.
It's not even in any of my code... presumably, I made the binding wrong, but what could I have done that would make it segfault like that?
ETA: stackframes from a crash:
Process: DocKeep [77998]
Path: /Users/acordex/Documents/projects/DocKeep/build/Debug/DocKeep.app/Contents/MacOS/DocKeep
Identifier: com.acordex.DocKeep
Version: 9.00 pre-Alpha (9.00 pre-Alpha)
Code Type: X86 (Native)
Parent Process: Instruments [77954]
Date/Time: 2010-07-29 10:01:11.927 -0400
OS Version: Mac OS X 10.6.4 (10F569)
Report Version: 6
Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x000000000000001c
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Thread 0 Crashed: Dispatch queue: com.apple.main-thread
0 com.apple.AppKit 0x954a4734 -[NSDocument(NSEditorRegistration) _isBeingEdited] + 24
1 com.apple.AppKit 0x954a4707 -[NSDocument isDocumentEdited] + 47
2 com.apple.AppKit 0x955b3900 -[NSDocument(NSEditorRegistration) objectDidBeginEditing:] + 48
3 com.apple.AppKit 0x95461ef9 -[NSValueBinder _startChanging] + 126
4 com.apple.AppKit 0x95461dc1 -[NSTextValueBinder _startChanging] + 60
5 com.apple.AppKit 0x95461d5f -[_NSBindingAdaptor _editor:didChangeEditingState:bindingAdaptor:] + 181
6 com.apple.AppKit 0x95461c9f -[_NSBindingAdaptor editorDidBeginEditing:] + 278
7 com.apple.AppKit 0x95442e5a -[NSTextField textShouldBeginEditing:] + 239
8 com.apple.AppKit 0x95441d0b -[NSTextView(NSSharing) shouldChangeTextInRanges:replacementStrings:] + 573
9 com.apple.AppKit 0x95464563 _NSDoUserReplaceForCharRange + 191
10 com.apple.AppKit 0x9546449e _NSDoUserDeleteForCharRange + 79
11 com.apple.AppKit 0x95463b07 -[NSTextView(NSKeyBindingCommands) deleteBackward:] + 684
12 com.apple.AppKit 0x9544b364 -[NSResponder doCommandBySelector:] + 77
13 com.apple.AppKit 0x9544ac7f -[NSTextView doCommandBySelector:] + 240
14 com.apple.AppKit 0x95439bbf -[NSKeyBindingManager(NSKeyBindingManager_MultiClients) interpretEventAsCommand:forClient:] + 1911
15 com.apple.AppKit 0x9543d44f -[NSTextInputContext handleEvent:] + 1604
16 com.apple.AppKit 0x95439229 -[NSView interpretKeyEvents:] + 209
17 com.apple.AppKit 0x9543ccd5 -[NSTextView keyDown:] + 751
18 com.apple.AppKit 0x9536df6c -[NSWindow sendEvent:] + 5757
19 com.apple.AppKit 0x95286aff -[NSApplication sendEvent:] + 6431
20 com.apple.AppKit 0x9521a5bb -[NSApplication run] + 917
21 com.apple.AppKit 0x952125ed NSApplicationMain + 574
22 com.acordex.DocKeep 0x0000224c main + 30 (main.m:14)
23 com.acordex.DocKeep 0x00002202 start + 54
Thread 1:
0 libSystem.B.dylib 0x94a319d2 __workq_kernreturn + 10
1 libSystem.B.dylib 0x94a31f68 _pthread_wqthread + 941
2 libSystem.B.dylib 0x94a31b86 start_wqthread + 30
Thread 2: Dispatch queue: com.apple.libdispatch-manager
0 libSystem.B.dylib 0x94a32942 kevent + 10
1 libSystem.B.dylib 0x94a3305c _dispatch_mgr_invoke + 215
2 libSystem.B.dylib 0x94a32519 _dispatch_queue_invoke + 163
3 libSystem.B.dylib 0x94a322be _dispatch_worker_thread2 + 240
4 libSystem.B.dylib 0x94a31d41 _pthread_wqthread + 390
5 libSystem.B.dylib 0x94a31b86 start_wqthread + 30
Thread 3:
0 libSystem.B.dylib 0x94a3a066 __semwait_signal + 10
1 libSystem.B.dylib 0x94a39d22 _pthread_cond_wait + 1191
2 libSystem.B.dylib 0x94a3b9b8 pthread_cond_wait$UNIX2003 + 73
3 com.apple.CoreVideo 0x96730c3e CVDisplayLink::runIOThread() + 1016
4 com.apple.CoreVideo 0x9673082a startIOThread(void*) + 156
5 libSystem.B.dylib 0x94a3981d _pthread_start + 345
6 libSystem.B.dylib 0x94a396a2 thread_start + 34
Thread 0 crashed with X86 Thread State (32-bit):
eax: 0x00000000 ebx: 0x954a472d ecx: 0x00000001 edx: 0x00000000
edi: 0x0045f650 esi: 0x0045f650 ebp: 0xbfffe738 esp: 0xbfffe720
ss: 0x0000001f efl: 0x00010282 eip: 0x954a4734 cs: 0x00000017
ds: 0x0000001f es: 0x0000001f fs: 0x00000000 gs: 0x00000037
cr2: 0x0000001c
I DO have a document class that is subclassed off of NSDocument
, and the textfield IS bound to a field of that document object, but I'm not sure why that would matter.