xi-editor / xi-mac

The xi-editor mac frontend.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

crash when reviewing changes on close

cmyr opened this issue · comments

Haven't tried to reproduce this; just came across it after being prompted to review my unsaved changes after quiting with cmdQ.

There were two documents with unsaved changes; this crash occurred after saving the first.

Feels like a race; some update is coming in after the save, and the document is closed and we're trying to use an invalid index? I'm not totally sure about the particulars, though.

Date/Time:             2019-02-04 15:41:58.214 -0500
OS Version:            Mac OS X 10.14.2 (18C54)
Report Version:        12
Bridge OS Version:     3.2 (16P2542)
Anonymous UUID:        0505F712-5AAD-8CB1-77FF-471C183040D2

Sleep/Wake UUID:       9CF6F5BF-034F-4444-BD1E-2B049A9720EC

Time Awake Since Boot: 810000 seconds
Time Since Wake:       1600 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Application Specific Information:
*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArray0 objectAtIndex:]: index 0 beyond bounds for empty NSArray'
terminating with uncaught exception of type NSException
abort() called

Application Specific Backtrace 1:
0   CoreFoundation                      0x00007fff37573ecd __exceptionPreprocess + 256
1   libobjc.A.dylib                     0x00007fff6362f720 objc_exception_throw + 48
2   CoreFoundation                      0x00007fff3759a5f1 __CFArrayCopyDescription + 0
3   XiEditor                            0x000000010d6ce699 $Ss12_ArrayBufferV19_getElementSlowPathyyXlSiFSo10NSMenuItemC_Tg5Tm + 73
4   XiEditor                            0x000000010d6c26dd $S8XiEditor18EditViewControllerC11updateAsync0F0ySDySSyXlG_tFyycfU_ + 861
5   XiEditor                            0x000000010d6d6499 $S8XiEditor18EditViewControllerC11updateAsync0F0ySDySSyXlG_tFyycfU_TA + 25
6   XiEditor                            0x000000010d763cf0 $SIeg_IeyB_TR + 32
7   libdispatch.dylib                   0x00007fff646aed53 _dispatch_call_block_and_release + 12
8   libdispatch.dylib                   0x00007fff646afdcf _dispatch_client_callout + 8
9   libdispatch.dylib                   0x00007fff646baf63 _dispatch_main_queue_callback_4CF + 1125
10  CoreFoundation                      0x00007fff374bd1ab __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
11  CoreFoundation                      0x00007fff374bc8ba __CFRunLoopRun + 2335
12  CoreFoundation                      0x00007fff374bbd48 CFRunLoopRunSpecific + 463
13  HIToolbox                           0x00007fff36752ab5 RunCurrentEventLoopInMode + 293
14  HIToolbox                           0x00007fff367527eb ReceiveNextEventCommon + 618
15  HIToolbox                           0x00007fff36752568 _BlockUntilNextEventMatchingListInModeWithFilter + 64
16  AppKit                              0x00007fff34a0d363 _DPSNextEvent + 997
17  AppKit                              0x00007fff34a0c102 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1362
18  AppKit                              0x00007fff34d43f73 -[NSApplication _shouldTerminate] + 1347
19  AppKit                              0x00007fff34c1495d -[NSApplication terminate:] + 765
20  AppKit                              0x00007fff34d0660b -[NSApplication(NSResponder) sendAction:to:from:] + 312
21  AppKit                              0x00007fff34d6363f -[NSMenuItem _corePerformAction] + 323
22  AppKit                              0x00007fff34d633b2 -[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] + 114
23  AppKit                              0x00007fff34d62214 -[NSMenu performKeyEquivalent:] + 363
24  AppKit                              0x00007fff35209fb7 routeKeyEquivalent + 870
25  AppKit                              0x00007fff34a18c39 -[NSApplication(NSEvent) sendEvent:] + 1077
26  AppKit                              0x00007fff34a0619d -[NSApplication run] + 755
27  AppKit                              0x00007fff349f58a3 NSApplicationMain + 780
28  XiEditor                            0x000000010d6cade9 main + 9
29  libdyld.dylib                       0x00007fff646fded9 start + 1
30  ???                                 0x0000000000000001 0x0 + 1

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib        	0x00007fff6483d23e __pthread_kill + 10
1   libsystem_pthread.dylib       	0x00007fff648f3c1c pthread_kill + 285
2   libsystem_c.dylib             	0x00007fff647a61c9 abort + 127
3   libc++abi.dylib               	0x00007fff61e27231 abort_message + 231
4   libc++abi.dylib               	0x00007fff61e273cd default_terminate_handler() + 265
5   libobjc.A.dylib               	0x00007fff63631c87 _objc_terminate() + 97
6   libc++abi.dylib               	0x00007fff61e32dfe std::__terminate(void (*)()) + 8
7   libc++abi.dylib               	0x00007fff61e32e73 std::terminate() + 51
8   libdispatch.dylib             	0x00007fff646afde3 _dispatch_client_callout + 28
9   libdispatch.dylib             	0x00007fff646baf63 _dispatch_main_queue_callback_4CF + 1125
10  com.apple.CoreFoundation      	0x00007fff374bd1ab __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
11  com.apple.CoreFoundation      	0x00007fff374bc8ba __CFRunLoopRun + 2335
12  com.apple.CoreFoundation      	0x00007fff374bbd48 CFRunLoopRunSpecific + 463
13  com.apple.HIToolbox           	0x00007fff36752ab5 RunCurrentEventLoopInMode + 293
14  com.apple.HIToolbox           	0x00007fff367527eb ReceiveNextEventCommon + 618
15  com.apple.HIToolbox           	0x00007fff36752568 _BlockUntilNextEventMatchingListInModeWithFilter + 64
16  com.apple.AppKit              	0x00007fff34a0d363 _DPSNextEvent + 997
17  com.apple.AppKit              	0x00007fff34a0c102 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1362
18  com.apple.AppKit              	0x00007fff34d43f73 -[NSApplication _shouldTerminate] + 1347
19  com.apple.AppKit              	0x00007fff34c1495d -[NSApplication terminate:] + 765
20  com.apple.AppKit              	0x00007fff34d0660b -[NSApplication(NSResponder) sendAction:to:from:] + 312
21  com.apple.AppKit              	0x00007fff34d6363f -[NSMenuItem _corePerformAction] + 323
22  com.apple.AppKit              	0x00007fff34d633b2 -[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] + 114
23  com.apple.AppKit              	0x00007fff34d62214 -[NSMenu performKeyEquivalent:] + 363
24  com.apple.AppKit              	0x00007fff35209fb7 routeKeyEquivalent + 870
25  com.apple.AppKit              	0x00007fff34a18c39 -[NSApplication(NSEvent) sendEvent:] + 1077
26  com.apple.AppKit              	0x00007fff34a0619d -[NSApplication run] + 755
27  com.apple.AppKit              	0x00007fff349f58a3 NSApplicationMain + 780
28  io.xi-editor.XiEditor.Editor  	0x000000010d6cade9 main + 9 (AppDelegate.swift:80)
29  libdyld.dylib                 	0x00007fff646fded9 start + 1

Thread 1:: com.apple.NSEventThread
0   libsystem_kernel.dylib        	0x00007fff6483717a mach_msg_trap + 10
1   libsystem_kernel.dylib        	0x00007fff648376d0 mach_msg + 60
2   com.apple.CoreFoundation      	0x00007fff374bd0c2 __CFRunLoopServiceMachPort + 337
3   com.apple.CoreFoundation      	0x00007fff374bc611 __CFRunLoopRun + 1654
4   com.apple.CoreFoundation      	0x00007fff374bbd48 CFRunLoopRunSpecific + 463
5   com.apple.AppKit              	0x00007fff34a15f89 _NSEventThread + 160
6   libsystem_pthread.dylib       	0x00007fff648f1305 _pthread_body + 126
7   libsystem_pthread.dylib       	0x00007fff648f426f _pthread_start + 70
8   libsystem_pthread.dylib       	0x00007fff648f0415 thread_start + 13

Yeah, I can reproduce this (and think I have encountered this before, but didn't investigate further).

Huh, that was easier to fix than expected: #427