View deallocated on a background thread : how to debug? - objective-c

Sometimes my app crashes because a view is deallocated on a background thread but the problem is I can't figure out where it comes from.
Here is the crash log :
2016-11-28 12:21:44.753913 iCompta[3993:326592] -[NSView _registerWithBackdropView] should not be called off of the main thread. Invocation was here:(
0 AppKit 0x00007fff8f082779 -[NSView(NSInternal) _unregisterWithBackdropViewIfNeeded] + 404
1 AppKit 0x00007fff8f0995b6 -[NSView(NSInternal) _recursivelyNoteBackdropViewChanged] + 54
2 AppKit 0x00007fff8f099685 -[NSView(NSInternal) _recursivelyNoteBackdropViewChanged] + 261
3 AppKit 0x00007fff8f099685 -[NSView(NSInternal) _recursivelyNoteBackdropViewChanged] + 261
4 AppKit 0x00007fff8f099685 -[NSView(NSInternal) _recursivelyNoteBackdropViewChanged] + 261
5 AppKit 0x00007fff8f159fdd -[NSTableView _removeBackgroundView] + 194
6 AppKit 0x00007fff8f159f05 -[NSTableView viewWillMoveToSuperview:] + 65
7 AppKit 0x00007fff8f03b4cc -[NSView _setSuperview:] + 695
8 AppKit 0x00007fff8f1fddab -[NSTableView _setSuperview:] + 263
9 AppKit 0x00007fff8f041205 -[NSView removeFromSuperview] + 447
10 AppKit 0x00007fff8f3be133 -[NSOutlineView removeFromSuperview] + 56
11 AppKit 0x00007fff8f1627ec -[NSView removeFromSuperviewWithoutNeedingDisplay] + 38
12 AppKit 0x00007fff8f8d333e -[NSView _finalize] + 1008
13 AppKit 0x00007fff8f04ece3 -[NSView dealloc] + 350
14 AppKit 0x00007fff8f04eaf2 -[NSClipView dealloc] + 165
15 libobjc.A.dylib 0x00007fffa5e47e8d _ZN12_GLOBAL__N_119AutoreleasePoolPage3popEPv + 781
16 Foundation 0x00007fff92fb3b9b -[_NSXPCConnectionExportedObjectTable releaseExportedObject:] + 350
17 libdispatch.dylib 0x0000000100c5d74d _dispatch_call_block_and_release + 12
18 libdispatch.dylib 0x0000000100c53fcc _dispatch_client_callout + 8
19 libdispatch.dylib 0x0000000100c6bb0b _dispatch_queue_serial_drain + 205
20 libdispatch.dylib 0x0000000100c5d4f1 _dispatch_queue_invoke + 1174
21 libdispatch.dylib 0x0000000100c56247 _dispatch_root_queue_drain + 671
22 libdispatch.dylib 0x0000000100c55f58 _dispatch_worker_thread3 + 114
23 libsystem_pthread.dylib 0x0000000100ccb8c2 _pthread_wqthread + 1299
24 libsystem_pthread.dylib 0x0000000100ccb39d start_wqthread + 13
)
The name of the crashing thread is NSFileCoordinate so it seems related to file coordination but that doesn't help me much. Any idea to debug this ?

Finally I was able to solve the problem after much debugging. In my case the view at the origin of the crash is part of the window of a document and the crash sometimes occurs when you close the document.
When you close the document and there is a modification, asynchronous saving is launched and I discovered that sometimes the document is finally released on a background queue which then leads to the window and the views inside it being also released on that background queue.
So my solution was to hold a strong reference to the root view of my window in the dealloc method of my document and dispatching a block on the main queue after 1 second to nullify that reference. This way I ensure all the views are deallocated on the main thread.

Related

Non-existent user defined runtime attribute

I have a simple Mac application that receives the following error when opening a document:
Failed to set (allowsDragging) user defined inspected property on (PKMPDFView): [ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key allowsDragging.
If I intercept the "set" attempt, I see that it originates from the method -[NSIBUserDefinedRuntimeAttributesConnector establishConnection] during nib loading.
Full trace:
0 PDFApp 0x0000000100003592 -[PKMPDFView setValue:forUndefinedKey:] + 49
1 Foundation 0x00007fff309b8dde -[NSObject(NSKeyValueCoding) setValue:forKey:] + 331
2 AppKit 0x00007fff2c08af15 -[NSView setValue:forKeyPath:] + 394
3 AppKit 0x00007fff2c00d029 -[NSIBUserDefinedRuntimeAttributesConnector establishConnection] + 637
4 AppKit 0x00007fff2bdd9719 -[NSIBObjectData nibInstantiateWithOwner:options:topLevelObjects:] + 1430
5 AppKit 0x00007fff2bdd0991 loadNib + 435
6 AppKit 0x00007fff2bdcfeb5 +[NSBundle(NSNibLoading) _loadNibFile:nameTable:options:withZone:ownerBundle:] + 696
7 AppKit 0x00007fff2c005aba +[NSBundle(NSNibLoadingInternal) _loadNibFile:externalNameTable:options:withZone:] + 150
8 AppKit 0x00007fff2c005893 -[NSWindowController loadWindow] + 322
9 AppKit 0x00007fff2be18cf5 -[NSWindowController window] + 84
10 AppKit 0x00007fff2bfd8134 -[NSWindowController showWindow:] + 36
11 AppKit 0x00007fff2be18c7a -[NSDocument showWindows] + 116
12 PDFApp 0x0000000100002e75 -[PKMPDFDocument showWindows] + 50
13 AppKit 0x00007fff2c35f13e __80-[NSDocumentController openDocumentWithContentsOfURL:display:completionHandler:]_block_invoke.1039 + 182
14 AppKit 0x00007fff2c36ef70 ___NSMainRunLoopPerformBlock_block_invoke + 25
15 CoreFoundation 0x00007fff2e897a3c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
16 CoreFoundation 0x00007fff2e87a973 __CFRunLoopDoBlocks + 275
17 CoreFoundation 0x00007fff2e879ffe __CFRunLoopRun + 1278
18 CoreFoundation 0x00007fff2e879867 CFRunLoopRunSpecific + 487
19 HIToolbox 0x00007fff2db59d96 RunCurrentEventLoopInMode + 286
20 HIToolbox 0x00007fff2db59b06 ReceiveNextEventCommon + 613
21 HIToolbox 0x00007fff2db59884 _BlockUntilNextEventMatchingListInModeWithFilter + 64
22 AppKit 0x00007fff2be09a73 _DPSNextEvent + 2085
23 AppKit 0x00007fff2c59fe34 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 3044
24 AppKit 0x00007fff2bdfe885 -[NSApplication run] + 764
25 AppKit 0x00007fff2bdcda72 NSApplicationMain + 804
26 libdyld.dylib 0x00007fff56848015 start + 1
What confuses me is that PKMPDFView is a direct subclass of NSView and has no user defined properties associated with it in the .xib file being loaded. This view also has no outlets defined in the .xib, just a referencing outlet (contentView) from its document. Running find/grep through my development directory finds no instance of "allowsDragging" anywhere. Likewise, using the strings utility reveals no "allowsDragging" in the built app.
I've tried all the standard project cleaning with no change in symptoms.
At the moment, I'm tempted to simply override setValue:forUndefinedKey: and forget it but I'm still curious. Does anyone have information or good guesses about where this would be coming from?
(This is Xcode 10.1 on macOS 10.13.6, in case that matters.)

What are these magic addresses in my crash reports?

I maintain cTiVo, an open-source OS X project with a large user base. On Yosemite, I started getting sporadic crash notices (EXC_BAD_ACCESS KERN_INVALID_ADDRESS), and I haven't been able to track them down, nor ever reproduce them on my system, nor has anyone been able to reliably recreate them in the field. Although there are a lot of reports, the crashes occur infrequently, and mostly on Yosemite (primarily 10.10.2 and 10.10.3), despite the software running on lots of other systems back to 10.7. They occur across all types of hardware (MBPro, iMac's MacMinis and others). The program doesn't do anything particularly fancy in the UI, but it does drive a lot of command-line programs (via NSTask) to do video processing and related activities.
There are two strange things about the crashes.
First is that they seem to happen across the entire program at random places both in my code and in Apple's routines. The most common (and unhelpful) is in the main run loop (see the first stacktrace below), and many of them happen within view displaying code, e.g. the second trace below. This would lead me to look for an over-released object normally, but as I said, it seems to happen to every kind of object in the program.
The second strange thing is after looking through literally hundreds of these, the invalid addresses upon which they crash almost entirely fall into one of two groups:
0x0000000002798000
0x0000000002998000
0x0000000002A98000
0x0000000002B98000
0x0000000003098000
0x0000000003198000
0x0000000003298000
0x0000000003398000
0x0000000003498000
0x0000000003898000
0x0000000003998000
0x0000000003A98000
0x00000000047ffff8
0x0000000004fffff8
0x00000000057ffff8
0x0000000005fffff8
0x00000000067ffff8
0x0000000006fffff8
0x00000000077ffff8
0x0000000007fffff8
I've stared at these for a long time, and haven't been able to figure out what this tight grouping of invalid addresses might mean. The first group are 1MiB apart and the second are 8MiB apart; AFAIK, I don't have any structures that large in my program. The second group seems to be normally distributed in frequency around 5FFFF8 as the most common. I don't see the same pattern in the first group (there might be two centers, but that may be overfitting the data). In binary, they fall into these patterns (although some of the first group don't seem to appear).
0000001X XXXX1001 10000000 00000000
000001XX X1111111 11111111 11111000
I should mention I also get one other error EXC_ARITHMETIC EXC_I386_DIV at 0x0000000000000000, again at very random places, and there doesn't seem to be any dividing going on.
Any suggestions on why these addresses appear in this patterns, that might give a clue on where to look would be great!
Here's the sample stack traces...
Thread : Crashed: com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fff94a6a4de mach_msg_trap + 10
1 CoreFoundation 0x00007fff9288eeb4 __CFRunLoopServiceMachPort + 212
2 CoreFoundation 0x00007fff9288e37b __CFRunLoopRun + 1371
3 CoreFoundation 0x00007fff9288dbd8 CFRunLoopRunSpecific + 296
4 HIToolbox 0x00007fff94e3956f RunCurrentEventLoopInMode + 235
5 HIToolbox 0x00007fff94e392ea ReceiveNextEventCommon + 431
6 HIToolbox 0x00007fff94e3912b _BlockUntilNextEventMatchingListInModeWithFilter + 71
7 AppKit 0x00007fff973169bb _DPSNextEvent + 978
8 AppKit 0x00007fff97315f68 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 346
9 AppKit 0x00007fff9730bbf3 -[NSApplication run] + 594
10 AppKit 0x00007fff97288354 NSApplicationMain + 1832
11 cTiVo 0x000000010871c234 start
Thread : Crashed: com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fff98b054de mach_msg_trap + 10
1 CoreGraphics 0x00007fff94ccfb41 _CGSAddStructuralRegionOfType + 148
2 CoreGraphics 0x00007fff94b29901 add_structural_region_of_type + 134
3 AppKit 0x00007fff90647394 _NXSetCursorRect + 680
4 AppKit 0x00007fff90646fa2 -[NSWindow _addCursorRect:cursor:forView:] + 889
5 AppKit 0x00007fff90646c0e -[NSView addCursorRect:cursor:] + 555
6 AppKit 0x00007fff90b1d517 -[NSTableHeaderView resetCursorRects] + 389
7 AppKit 0x00007fff905f9ddb -[NSView(NSInternal) _updateTrackingAreas] + 660
8 AppKit 0x00007fff905fa21b -[NSView(NSInternal) _updateTrackingAreas] + 1748
9 AppKit 0x00007fff905fa21b -[NSView(NSInternal) _updateTrackingAreas] + 1748
10 AppKit 0x00007fff905fb13e -[NSScrollView _updateTrackingAreas] + 119
11 AppKit 0x00007fff905fa21b -[NSView(NSInternal) _updateTrackingAreas] + 1748
12 AppKit 0x00007fff905fa21b -[NSView(NSInternal) _updateTrackingAreas] + 1748
13 AppKit 0x00007fff905fa21b -[NSView(NSInternal) _updateTrackingAreas] + 1748
14 AppKit 0x00007fff905fa21b -[NSView(NSInternal) _updateTrackingAreas] + 1748
15 AppKit 0x00007fff90645ab9 _handleInvalidCursorRectsNote + 1072
16 AppKit 0x00007fff90c1bd21 __35-[NSWindow _postInvalidCursorRects]_block_invoke3305 + 46
17 CoreFoundation 0x00007fff99154da7 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
18 CoreFoundation 0x00007fff99154d00 __CFRunLoopDoObservers + 368
19 CoreFoundation 0x00007fff99146e08 __CFRunLoopRun + 872
20 CoreFoundation 0x00007fff99146858 CFRunLoopRunSpecific + 296
21 HIToolbox 0x00007fff920a5aef RunCurrentEventLoopInMode + 235
22 HIToolbox 0x00007fff920a586a ReceiveNextEventCommon + 431
23 HIToolbox 0x00007fff920a56ab _BlockUntilNextEventMatchingListInModeWithFilter + 71
24 AppKit 0x00007fff904e5f81 _DPSNextEvent + 964
25 AppKit 0x00007fff904e5730 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 194
26 AppKit 0x00007fff904d9593 -[NSApplication run] + 594
27 AppKit 0x00007fff904c4a14 NSApplicationMain + 1832
28 cTiVo 0x0000000102a19234 start
Thread : Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x00007fff878ff0ee objc_msgSend + 46
1 AppKit 0x00007fff8e5519a1 -[CALayer(NSContentsAligning) NS_shouldUseContentsAligning] + 32
2 AppKit 0x00007fff8dca1ee9 _NSBackingLayerSetNeedsDisplayInRect + 178
3 QuartzCore 0x00007fff88e849f7 -[CALayer setNeedsDisplay] + 62
4 AppKit 0x00007fff8dca1e10 -[NSView(NSInternal) _setLayerNeedsDisplayInViewRect:] + 648
5 AppKit 0x00007fff8e33a1bb NSViewSetNeedsDisplayInRect + 1077
6 WebKitLegacy 0x00007fff89344b7e setNeedsDisplayInRect(NSView*, objc_selector*, CGRect) + 238
7 AppKit 0x00007fff8dc36772 -[NSView setNeedsDisplay:] + 81
8 AppKit 0x00007fff8dc6244f -[NSTextFieldCell setObjectValue:] + 88
9 AppKit 0x00007fff8dc61fc4 -[NSCell setStringValue:] + 111
10 AppKit 0x00007fff8dccd250 -[NSControl setStringValue:] + 138
11 cTiVo 0x00000001090cf92f -[MTDownloadTableView updateProgressInCell:forDL:] (MTDownloadTableView.m:158)
12 cTiVo 0x00000001090cfc6a -[MTDownloadTableView updateProgress:] (MTDownloadTableView.m:188)
13 CoreFoundation 0x00007fff8650bcdc __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
14 CoreFoundation 0x00007fff863fd244 _CFXNotificationPost + 3140
15 Foundation 0x00007fff91d55c31 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
16 cTiVo 0x000000010911cecc __93+[NSNotificationCenter(Threads) postNotificationNameOnMainThread:object:userInfo:afterDelay:]_block_invoke (NSNotificationCenter+Threads.m:44)
17 libdispatch.dylib 0x00007fff8a374323 _dispatch_call_block_and_release + 12
18 libdispatch.dylib 0x00007fff8a36fc13 _dispatch_client_callout + 8
19 libdispatch.dylib 0x00007fff8a37bcbf _dispatch_main_queue_callback_4CF + 861
20 CoreFoundation 0x00007fff864a2c79 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
21 CoreFoundation 0x00007fff8645f30f __CFRunLoopRun + 2159
22 CoreFoundation 0x00007fff8645e858 CFRunLoopRunSpecific + 296
23 HIToolbox 0x00007fff926c4aef RunCurrentEventLoopInMode + 235
24 HIToolbox 0x00007fff926c486a ReceiveNextEventCommon + 431
25 HIToolbox 0x00007fff926c46ab _BlockUntilNextEventMatchingListInModeWithFilter + 71
26 AppKit 0x00007fff8dc26f81 _DPSNextEvent + 964
27 AppKit 0x00007fff8dc26730 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 194
28 AppKit 0x00007fff8dc1a593 -[NSApplication run] + 594
29 AppKit 0x00007fff8dc05a14 NSApplicationMain + 1832
30 cTiVo 0x00000001090b5714 start

Understanding XCode debug area error messages

For example, I get this error in debug area:
2014-05-01 05:01:28.052 MyApp[93187:303] *** setObjectForKey: object cannot be nil (key: -1)
2014-05-01 05:01:28.057 MyApp[93187:303] (
0 CoreFoundation 0x00007fff8cb3f25c __exceptionPreprocess + 172
1 libobjc.A.dylib 0x00007fff89202e75 objc_exception_throw + 43
2 CoreFoundation 0x00007fff8ca3a46e -[__NSDictionaryM setObject:forKey:] + 1102
3 MyApp 0x0000000100009725 +[SystemTools getData:] + 5509
4 MyApp 0x0000000100001c4b -[AppDelegate drawCanvas:] + 1467
5 MyApp 0x0000000100001675 -[AppDelegate repeatingTimer:] + 85
6 Foundation 0x00007fff8ec480f4 __NSFireTimer + 96
7 CoreFoundation 0x00007fff8caa6564 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
8 CoreFoundation 0x00007fff8caa609f __CFRunLoopDoTimer + 1151
9 CoreFoundation 0x00007fff8cb175aa __CFRunLoopDoTimers + 298
10 CoreFoundation 0x00007fff8ca618e5 __CFRunLoopRun + 1525
11 CoreFoundation 0x00007fff8ca610b5 CFRunLoopRunSpecific + 309
12 HIToolbox 0x00007fff875dca0d RunCurrentEventLoopInMode + 226
13 HIToolbox 0x00007fff875dc7b7 ReceiveNextEventCommon + 479
14 HIToolbox 0x00007fff875dc5bc _BlockUntilNextEventMatchingListInModeWithFilter + 65
15 AppKit 0x00007fff907853de _DPSNextEvent + 1434
16 AppKit 0x00007fff90784a2b -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 122
17 AppKit 0x00007fff90778b2c -[NSApplication run] + 553
18 AppKit 0x00007fff90763913 NSApplicationMain + 940
19 MyApp 0x0000000100016aa2 main + 34
20 libdyld.dylib 0x00007fff9440b5fd start + 1
21 ??? 0x0000000000000003 0x0 + 3
)
Unfortunately, I have saveral "setObject:forKey:" calls in "SystemTools getData:" function.
How can I determine to which call this error is related? What that numbers (after plus) means?
Add an Execption breakpoint in your break points. This will halt at the line of code which is causing the app to crash. That way you dont have to debug with NSLogs.
The default behavior of Xcode is to stop where the exception is
caught, not where the exception is raised!
To explain those lines in the crash logs:
From Ray Wenderlich's blog:
2 XYZLib 0x34648e88 0x83000 + 8740
It is basically four columns:
The frame number – in this case, 2.
The name of the binary – in this case, XYZLib.
The address of the function that was called – in this case, 0x34648e88.
The fourth column is divided into two sub-columns, a base address and an offset. Here it is 0×83000 + 8740, where the first number points to the file, and the second points to the line of code in that file.
Use breakpoints in all of your setObject:forKey calls. Use NSLog for print some useful information in log. You are a developer so you need to know debugging also.
The first line of the output is useful here:
setObjectForKey: object cannot be nil (key: -1)
The NSDictionary doesn't like nil values, so look for a place in your getData method that could be assigning a nil value to a key of "-1".
Good luck!

Symbolicating Cocoa Mac App crash log

I have a Mac app on Mac App Store, I get the following crash in iTunes Connect. I don't have the dSYM file but I do have the MyApp.app from which the error comes. Is there some way I can symbolicate the following trace:
Thread 0 Crashed: Dispatch queue: com.apple.main-thread
0 ...xyz.myapp 0x00000001000078da 0x100000000 + 30938
1 ...xyz.myapp 0x000000010000a38a 0x100000000 + 41866
2 com.apple.AppKit 0x00007fff809c392e -[NSDocument writeToURL:ofType:error:] + 727
3 com.apple.AppKit 0x00007fff809bfcec -[NSDocument writeToURL:ofType:forSaveOperation:originalContentsURL:error:] + 432
4 com.apple.AppKit 0x00007fff809c3bd2 -[NSDocument _writeSafelyToURL:ofType:forSaveOperation:error:] + 281
5 com.apple.AppKit 0x00007fff809c2fd0 -[NSDocument writeSafelyToURL:ofType:forSaveOperation:error:] + 359
6 com.apple.AppKit 0x00007fff809be356 -[NSDocument saveToURL:ofType:forSaveOperation:error:] + 168
7 ...xyz.myapp 0x0000000100001c22 0x100000000 + 7202
8 com.apple.AppKit 0x00007fff809c1404 -[NSDocument _saveToURL:ofType:forSaveOperation:delegate:didSaveSelector:contextInfo:] + 85
9 com.apple.AppKit 0x00007fff809be637 -[NSDocument saveToURL:ofType:forSaveOperation:delegate:didSaveSelector:contextInfo:] + 683
10 com.apple.AppKit 0x00007fff809c077c -[NSDocument _savePanelWasPresented:withResult:inContext:] + 367
11 com.apple.AppKit 0x00007fff80b3035e -[NSSavePanel _didEndSheet:returnCode:contextInfo:] + 75
12 com.apple.AppKit 0x00007fff808d4d45 -[NSApplication endSheet:returnCode:] + 321
13 com.apple.AppKit 0x00007fff807e6eda -[NSApplication sendAction:to:from:] + 95
14 com.apple.AppKit 0x00007fff807e6e39 -[NSControl sendAction:to:] + 94
15 com.apple.AppKit 0x00007fff8087284b -[NSCell trackMouse:inRect:ofView:untilMouseUp:] + 1715
16 com.apple.AppKit 0x00007fff808a337a -[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:] + 555
17 com.apple.AppKit 0x00007fff808712f5 -[NSControl mouseDown:] + 624
18 com.apple.AppKit 0x00007fff8078b3a7 -[NSWindow sendEvent:] + 5409
19 com.apple.AppKit 0x00007fff806c0afa -[NSApplication sendEvent:] + 4719
20 com.apple.AppKit 0x00007fff806576de -[NSApplication run] + 474
21 com.apple.AppKit 0x00007fff806503b0 NSApplicationMain + 364
22 …xyz.myapp 0x0000000100001794 0x100000000 + 6036
I open the archive from Organizer using Show in finder -> Open package contents buy the dSYMs directory doesn't contain anything. Is it possible it is somewhere else? I created the archive using Xcode Menu -> Product -> Archive and Debug Information Format is set to Dwarf with DSym
You'll need the dSYM file. When you used Xcode to submit your application it will create an archive in your Xcode organizer. The archive also contains the dSYM information. Just right-click the archive you submitted and select "Reveal in Finder".

EXC_BAD_INSTRUCTION (SIGILL) at random during use of app. Bug in AppKit?

I'm currently testing a new version of an app of mine on OSX 10.5
An user reported some weird crashes during use of the application, sadly not reproducible by me. At first sight it seems to happen randomly, once he had the crash while opening an NSOpenPanel and once during focusing an NSTextField and once during NSView switch in a parent view.
If you have any idea which area I should look at it would be greatly appreciated!
I'm completely lost here.
App is compiled in XCode 3.2.1 with SDK 10.5 and targetted at 10.5
Please note the issue isn't visible for hundreds of customers but for at least one it is.
It's not in [openNZBFileButtonClick] only, the stacktraces seem to appear randomly even when clicking in an NSTextField once.
He send me these crashes:
Crash 1
Process: NZBVortex [43622]
Path: /Users/cero/Downloads/NZBVortex.app/Contents/MacOS/NZBVortex
Identifier: com.NZBVortex.NZBVortex
Version: 0.5.5 (0.5.5)
Code Type: X86-64 (Native)
Parent Process: launchd [97]
Interval Since Last Report: 1951 sec
Crashes Since Last Report: 1
Per-App Interval Since Last Report: 1858 sec
Per-App Crashes Since Last Report: 1
Date/Time: 2010-03-23 23:43:49.671 +0100
OS Version: Mac OS X 10.5.8 (9L31a)
Report Version: 6
Anonymous UUID: 98AB0386-590B-4E0D-B7AC-3F7AA4E7238E
Exception Type: EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes: 0x0000000000000001, 0x0000000000000000
Crashed Thread: 0
Application Specific Information:
objc[43622]: alt handlers in objc runtime are buggy!
- Hide quoted text -
Thread 0 Crashed:
0 libobjc.A.dylib 0x00007fff82baef6e _objc_fatal + 238
1 libobjc.A.dylib 0x00007fff82bb2ea4
objc_addExceptionHandler + 302
2 com.apple.CoreFoundation 0x00007fff842b1090
_CFDoExceptionOperation + 528
3 com.apple.AppKit 0x00007fff81f75e26 _NSAppKitLock + 81
4 com.apple.AppKit 0x00007fff81f80f8f -[NSView nextKeyView] + 56
5 com.apple.AppKit 0x00007fff81f81018 -[NSView
_primitiveSetNextKeyView:] + 72
6 com.apple.AppKit 0x00007fff820732b1 -[NSView
_recursiveSetDefaultKeyViewLoop] + 242
7 com.apple.AppKit 0x00007fff82073300 -[NSView
_recursiveSetDefaultKeyViewLoop] + 321
8 com.apple.AppKit 0x00007fff82073300 -[NSView
_recursiveSetDefaultKeyViewLoop] + 321
9 com.apple.AppKit 0x00007fff82073300 -[NSView
_recursiveSetDefaultKeyViewLoop] + 321
10 com.apple.AppKit 0x00007fff82073300 -[NSView
_recursiveSetDefaultKeyViewLoop] + 321
11 com.apple.AppKit 0x00007fff82072fc3 -[NSView
_setDefaultKeyViewLoop] + 279
12 com.apple.AppKit 0x00007fff82072e70 -[NSWindow
recalculateKeyViewLoop] + 36
13 com.apple.AppKit 0x00007fff821dd149
-[NSSavePanel(NSSavePanelRuntime) _loadPreviousModeAndLayout] + 39
14 com.apple.AppKit 0x00007fff821dcf9e
-[NSSavePanel(NSSavePanelRuntime) runModalForDirectory:file:types:] +
71
15 com.NZBVortex.NZBVortex 0x000000010000b7ee
-[MainWindowViewController openNZBFileButtonClick:] + 62
16 com.apple.AppKit 0x00007fff821c96bf
-[NSToolbarButton sendAction:to:] + 77
17 com.apple.AppKit 0x00007fff821c8bb7
-[NSToolbarItemViewer mouseDown:] + 5362
18 com.apple.AppKit 0x00007fff82082783 -[NSWindow
sendEvent:] + 5068
19 com.apple.AppKit 0x00007fff8204fd46 -[NSApplication
sendEvent:] + 5089
20 com.apple.AppKit 0x00007fff81faa562 -[NSApplication run] + 497
21 com.apple.AppKit 0x00007fff81f772f0 NSApplicationMain + 373
22 com.NZBVortex.NZBVortex 0x0000000100012a69 main + 9
23 com.NZBVortex.NZBVortex 0x0000000100001a84 start + 52
Crash 2
Process: NZBVortex [43600]
Path: /Users/cero/Downloads/NZBVortex.app/Contents/MacOS/NZBVortex
Identifier: com.NZBVortex.NZBVortex
Version: 0.5.5 (0.5.5)
Code Type: X86-64 (Native)
Parent Process: launchd [97]
Interval Since Last Report: 727 sec
Crashes Since Last Report: 1
Per-App Interval Since Last Report: 616 sec
Per-App Crashes Since Last Report: 1
Date/Time: 2010-03-23 23:11:20.000 +0100
OS Version: Mac OS X 10.5.8 (9L31a)
Report Version: 6
Anonymous UUID: 98AB0386-590B-4E0D-B7AC-3F7AA4E7238E
Exception Type: EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes: 0x0000000000000001, 0x0000000000000000
Crashed Thread: 0
Application Specific Information:
objc[43600]: alt handlers in objc runtime are buggy!
Thread 0 Crashed:
0 libobjc.A.dylib 0x00007fff82baef6e _objc_fatal + 238
1 libobjc.A.dylib 0x00007fff82bb2ea4
objc_addExceptionHandler + 302
2 com.apple.CoreFoundation 0x00007fff842b1090
_CFDoExceptionOperation + 528
3 com.apple.AppKit 0x00007fff81f75e26 _NSAppKitLock + 81
4 com.apple.AppKit 0x00007fff81f80f8f -[NSView nextKeyView] + 56
5 com.apple.AppKit 0x00007fff81f81018 -[NSView
_primitiveSetNextKeyView:] + 72
6 com.apple.AppKit 0x00007fff820732b1 -[NSView
_recursiveSetDefaultKeyViewLoop] + 242
7 com.apple.AppKit 0x00007fff82156700 -[NSTabView
_recursiveSetDefaultKeyViewLoop] + 119
8 com.apple.AppKit 0x00007fff82073300 -[NSView
_recursiveSetDefaultKeyViewLoop] + 321
9 com.apple.AppKit 0x00007fff82073300 -[NSView
_recursiveSetDefaultKeyViewLoop] + 321
10 com.apple.AppKit 0x00007fff82072fc3 -[NSView
_setDefaultKeyViewLoop] + 279
11 com.apple.AppKit 0x00007fff82072e70 -[NSWindow
recalculateKeyViewLoop] + 36
12 com.NZBVortex.NZBVortex 0x000000010000b527
-[MainWindowViewController showView:sender:] + 1639
13 com.NZBVortex.NZBVortex 0x000000010000ae6b
-[MainWindowViewController
preferencesSaveAlertDidEnd:returnCode:contextInfo:] + 91
14 com.apple.AppKit 0x00007fff82224291 -[NSAlert
didEndAlert:returnCode:contextInfo:] + 107
15 com.apple.AppKit 0x00007fff82224197 -[NSAlert
buttonPressed:] + 279
16 com.apple.AppKit 0x00007fff82085d46 -[NSApplication
sendAction:to:from:] + 97
17 com.apple.AppKit 0x00007fff82085c7f -[NSControl
sendAction:to:] + 97
18 com.apple.AppKit 0x00007fff820851b0 -[NSCell
trackMouse:inRect:ofView:untilMouseUp:] + 1841
19 com.apple.AppKit 0x00007fff820849d6 -[NSButtonCell
trackMouse:inRect:ofView:untilMouseUp:] + 611
20 com.apple.AppKit 0x00007fff8208422f -[NSControl
mouseDown:] + 735
21 com.apple.AppKit 0x00007fff82082783 -[NSWindow
sendEvent:] + 5068
22 com.apple.AppKit 0x00007fff8204fd46 -[NSApplication
sendEvent:] + 5089
23 com.apple.AppKit 0x00007fff81faa562 -[NSApplication run] + 497
24 com.apple.AppKit 0x00007fff81f772f0 NSApplicationMain + 373
25 com.NZBVortex.NZBVortex 0x0000000100012a69 main + 9
26 com.NZBVortex.NZBVortex 0x0000000100001a84 start + 52
Crash 3
Process: NZBVortex [43520]
Path: /Users/cero/Downloads/NZBVortex.app/Contents/MacOS/NZBVortex
Identifier: com.NZBVortex.NZBVortex
Version: 0.5.5 (0.5.5)
Code Type: X86-64 (Native)
Parent Process: launchd [97]
Interval Since Last Report: 23487 sec
Crashes Since Last Report: 2
Per-App Interval Since Last Report: 2025 sec
Per-App Crashes Since Last Report: 1
Date/Time: 2010-03-23 22:59:05.484 +0100
OS Version: Mac OS X 10.5.8 (9L31a)
Report Version: 6
Anonymous UUID: 98AB0386-590B-4E0D-B7AC-3F7AA4E7238E
Exception Type: EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes: 0x0000000000000001, 0x0000000000000000
Crashed Thread: 0
Application Specific Information:
objc[43520]: alt handlers in objc runtime are buggy!
Thread 0 Crashed:
0 libobjc.A.dylib 0x00007fff82baef6e _objc_fatal + 238
1 libobjc.A.dylib 0x00007fff82bb2ea4
objc_addExceptionHandler + 302
2 com.apple.CoreFoundation 0x00007fff842b1090
_CFDoExceptionOperation + 528
3 com.apple.AppKit 0x00007fff81f75e26 _NSAppKitLock + 81
4 com.apple.AppKit 0x00007fff81f80f8f -[NSView nextKeyView] + 56
5 com.apple.AppKit 0x00007fff81f81018 -[NSView
_primitiveSetNextKeyView:] + 72
6 com.apple.AppKit 0x00007fff820732b1 -[NSView
_recursiveSetDefaultKeyViewLoop] + 242
7 com.apple.AppKit 0x00007fff82073300 -[NSView
_recursiveSetDefaultKeyViewLoop] + 321
8 com.apple.AppKit 0x00007fff82073300 -[NSView
_recursiveSetDefaultKeyViewLoop] + 321
9 com.apple.AppKit 0x00007fff82073300 -[NSView
_recursiveSetDefaultKeyViewLoop] + 321
10 com.apple.AppKit 0x00007fff82073300 -[NSView
_recursiveSetDefaultKeyViewLoop] + 321
11 com.apple.AppKit 0x00007fff82072fc3 -[NSView
_setDefaultKeyViewLoop] + 279
12 com.apple.AppKit 0x00007fff82072e70 -[NSWindow
recalculateKeyViewLoop] + 36
13 com.apple.AppKit 0x00007fff821dd149
-[NSSavePanel(NSSavePanelRuntime) _loadPreviousModeAndLayout] + 39
14 com.apple.AppKit 0x00007fff821dcf9e
-[NSSavePanel(NSSavePanelRuntime) runModalForDirectory:file:types:] +
71
15 com.NZBVortex.NZBVortex 0x000000010000b7ee
-[MainWindowViewController openNZBFileButtonClick:] + 62
16 com.apple.AppKit 0x00007fff821c96bf
-[NSToolbarButton sendAction:to:] + 77
17 com.apple.AppKit 0x00007fff821c8bb7
-[NSToolbarItemViewer mouseDown:] + 5362
18 com.apple.AppKit 0x00007fff82082783 -[NSWindow
sendEvent:] + 5068
19 com.apple.AppKit 0x00007fff8204fd46 -[NSApplication
sendEvent:] + 5089
20 com.apple.AppKit 0x00007fff81faa562 -[NSApplication run] + 497
21 com.apple.AppKit 0x00007fff81f772f0 NSApplicationMain + 373
22 com.NZBVortex.NZBVortex 0x0000000100012a69 main + 9
23 com.NZBVortex.NZBVortex 0x0000000100001a84 start + 52
I am answering my own question, but the credits should go to diciu and tedge.
If they create an answer here I will move over the check to their account.
The solution was running the app in 32bit mode;
more info: http://lists.apple.com/archives/objc-language/2008/Sep/msg00111.html
It looks like you have an error in openNZBFileButtonClick:; or possibly you have set Release when closed on a window that shouldn't have it.
A crash bug in AppKit vis-a-vis window handling seems fairly unlikely.