crash on a window close

I have a window that pops up from my main window when a button is pressed and in the window a timer runs (set to 250) to refresh a canvas (puts new text over a colored png file). I’m thinking the timer is still trying to run on close and trying to access an object or variable that has already been killed off by the close button. Does that sound right? should I check every control and property for nil in the timer’s action? Or might something else be causing this. Here is a partial crash report:

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:
abort() called
*** error for object 0x7fe5d475eea8: incorrect checksum for freed object - object was probably modified after being freed.
 

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib        	0x00007fff7a26ab66 __pthread_kill + 10
1   libsystem_pthread.dylib       	0x00007fff7a435080 pthread_kill + 333
2   libsystem_c.dylib             	0x00007fff7a1c61ae abort + 127
3   libsystem_malloc.dylib        	0x00007fff7a2cfad4 szone_error + 596
4   libsystem_malloc.dylib        	0x00007fff7a2c4616 tiny_malloc_from_free_list + 1155
5   libsystem_malloc.dylib        	0x00007fff7a2c33bf szone_malloc_should_clear + 422
6   libsystem_malloc.dylib        	0x00007fff7a2c31bd malloc_zone_malloc + 103
7   libsystem_malloc.dylib        	0x00007fff7a2c24c7 malloc + 24
8   com.apple.CoreGraphics        	0x00007fff52709a24 std::__1::list<CG::Chunk, CG::Allocator<CG::Chunk> >::list(std::__1::list<CG::Chunk, CG::Allocator<CG::Chunk> > const&) + 70
9   com.apple.CoreGraphics        	0x00007fff52709b11 std::__1::vector<CG::Path::Subpath, CG::Allocator<CG::Path::Subpath> >::__swap_out_circular_buffer(std::__1::__split_buffer<CG::Path::Subpath, CG::Allocator<CG::Path::Subpath>&>&) + 49
10  com.apple.CoreGraphics        	0x00007fff5275e370 void std::__1::vector<CG::Path::Subpath, CG::Allocator<CG::Path::Subpath> >::__push_back_slow_path<CG::Path::Subpath const&>(CG::Path::Subpath const&&&) + 222
11  com.apple.CoreGraphics        	0x00007fff5275e241 CG::Path::Sequence::append(CG::Path::Shape*, CGAffineTransform const*) + 161
12  com.apple.CoreGraphics        	0x00007fff5275e001 CGPathAddRects + 200
13  com.apple.CoreGraphics        	0x00007fff5275c23c CGContextClipToRects + 141

Another crash report gave me this:

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

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       EXC_I386_GPFLT
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [0]

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   com.apple.CoreGraphics        	0x00007fff52709bbd std::__1::__list_imp<CG::Chunk, CG::Allocator<CG::Chunk> >::clear() + 31
1   com.apple.CoreGraphics        	0x00007fff5272a072 std::__1::__vector_base<CG::Path::Subpath, CG::Allocator<CG::Path::Subpath> >::~__vector_base() + 40
2   com.apple.CoreGraphics        	0x00007fff5272a03c CG::Path::Sequence::~Sequence() + 28
3   com.apple.CoreGraphics        	0x00007fff5275e052 CGPathAddRects + 281
4   com.apple.CoreGraphics        	0x00007fff5275c23c CGContextClipToRects + 141
5   com.apple.AppKit              	0x00007fff4f9bb613 -[NSView _drawRect:clip:] + 1522
6   com.apple.AppKit              	0x00007fff4f9ba598 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 4844
7   com.apple.AppKit              	0x00007fff4f9b9ec5 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 3097
8   com.apple.AppKit              	0x00007fff4f9b8ddb -[NSThemeFrame _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 327
9   com.apple.AppKit              	0x00007fff501244e0 -[NSView _oldDisplayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] + 2051
10  com.apple.AppKit              	0x00007fff4f9b7e5d -[NSView _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] + 253
11  com.apple.AppKit              	0x00007fff4f9b40b4 -[NSView displayIfNeeded] + 1581
12  com.apple.AppKit              	0x00007fff4f9b3a52 -[NSWindow displayIfNeeded] + 321
13  com.apple.AppKit              	0x00007fff5015460d ___NSWindowGetDisplayCycleObserver_block_invoke.5902 + 308
14  com.apple.AppKit              	0x00007fff4f9b355e __37+[NSDisplayCycle currentDisplayCycle]_block_invoke + 695

Why not set the

timer1.mode = 0

in the close event?

I see this occasionally also, but it’s not consistent for me and therefore been impossible to reliably reproduce.

yeah it’s not consistent for me. I had disabled the timer on close but that didn’t help. would mode = 0 act any differently?

I put Try/Catch in the timer’s action but haven’t tested it long enough to see if it’s preventing the crash. So far so good.

had another crash with Try/Catch. It seems to either happen right after I close the window or maybe 15 seconds later when I go to click on another control. Would the Activity Monitor give me any clues other than the crash reports? just doesn’t happen often enough to help me pinpoint it so i can figure out the cause.

I’m under El Capitan and I have this issue too. My Xojo apps crash sometimes when I close a document window (not Main window) or when I close the Main window and quit, and other windows are opened (then are closed when quit).

Would you have a thread on that window ?

Looking again at the second crash report; I can tell you its crashing while drawing the window chrome (buttons or title or stuff). My guess is that the OS thinks something needs updating; but the window is already out of scope.

or a timer with a call later ?
thats a frequent suspect

[quote=435874:@Norman Palardy]or a timer with a call later ?
thats a frequent suspect[/quote]
That’s true, bitten me a couple of times.

It seems the random crash of closing window only appears when the window contains a ListBox. I thought, when I read in 2019r1.1 Release Notes “Listbox no longer leaks memory when Paint events are handled.” that the bug will disappear but no.
I open and close a window of one of my program which has no ListBox and I didn’t reach to make it crash.
I have 11 programs with window, I’m nearly sure only windows with ListBox crash when closed. But I can’t be totally sure, I didn’t feel a crash log.

Does anybody else has the same feeling?

There was a bug a while ago where threads remained when closing windows, crashing badly.

If you are close to be certain the listbox creates the crash at window close, you could remove it first.

[quote=438029:@Thomas ROBISSON]It seems the random crash of closing window only appears when the window contains a ListBox. I thought, when I read in 2019r1.1 Release Notes “Listbox no longer leaks memory when Paint events are handled.” that the bug will disappear but no.
I open and close a window of one of my program which has no ListBox and I didn’t reach to make it crash.
I have 11 programs with window, I’m nearly sure only windows with ListBox crash when closed. But I can’t be totally sure, I didn’t feel a crash log.

Does anybody else has the same feeling?[/quote]

No
Post a full crash log and there might be something that can be determined
Patricks are only partial and there could be relevant items that were truncated from those logs

It’s my synchronisation soft SyncTwoFolders. I launch the sync in a thread, before launch the thread, I put a flag DrapMenu to false and disable all buttons and menus. I can’t close windows (cancel close not DrapMenu) neither than quit the app. The only button remaining active is the Start button which is became a stop button. Once the thread ends, it launch a timer which put the DrapMenu flag back to true and re-enable all buttons and menus, it open a log window showing all oprations of files synchonized. The bug occurs when I close this Log window (which is not the Main window), sometimes it crash on first attempt, sometimes I have to open and close it many times to reproduce the crash. I can open and close the Log window, it remember the files synchronized in the last synchronization. I’m running El Capitan.
Here is the crash log :

I have problem posting with the crash log in the post. Please download it SyncTwoFolders-CrashLog-01.txt .

The second soft is MemoDate which as the ListBox on its MainWindow. Same as my others programs, before launch the thread, I put a flag to false and disable all buttons and menus except the start button which become Stop. I can’t quit, can’t close window. The thread read a text file and Apple AdressBook birthday and list oncoming event in the listbox. When the thread ends it launch a timer which put the flag back to true and re-enable menus and buttons.
When I quit the application, or close the Main window which quit the app, I sometimes have the crash.
Please download it MemoDate-CrashLog-01.txt.

I’ve too have been frustrated recently with apps built with Xojo 2019 r1 and r1.1 randomly crashing on Yosemite. The apps simply blink out of existence with no exceptions raised. Crashes occur in all parts of the app.

In checking MacOS crash logs, I noticed that this entry was always present:

com.xojo.XojoFramework 0x0000000108359f2d non-virtual thunk to CocoaPopupMenu::~CocoaPopupMenu() + 21

I’ve since determined that crashes happen randomly when a window containing populated popupmenus is closed. While this issue affects Yosemite, it may affect other OS versions that I am unable to test. It does not appear to affect Mojave.

As a workaround, I created a method to clear the popups:

Function ClearAllPopups extends w as window for i as integer = 0 to w.ControlCount-1 dim c as Control = w.Control(i) if c isa PopupMenu then PopupMenu(c).DeleteAllRows end if next End Function

Then on any window with popupmenus, I call ClearAllPopups at the end of the window’s close event.

Haven’t had a crash since.

That looks like a crash in the destructor of the framework class (the C++ destructor)

I am getting the same crash report, it is not associated with closing windows.

Process:               XXX [488]
Path:                  
Identifier:            com.XXX.XXX
Version:               13.9.2 (13.9.2.2.62)
Code Type:             X86-64 (Native)
Parent Process:        ??? [1]
Responsible:           XXX [488]
User ID:               502

Date/Time:             2019-05-25 10:14:16.986 -0600
OS Version:            Mac OS X 10.11.6 (15G31)
Report Version:        11
Anonymous UUID:        E1A41487-F4F8-DE38-6FD8-794862929101


Time Awake Since Boot: 180 seconds

System Integrity Protection: enabled

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

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000020
Exception Note:        EXC_CORPSE_NOTIFY

VM Regions Near 0x20:
--> 
    __TEXT                 00000001051f7000-000000010a1c9000 [ 79.8M] r-x/rwx SM=COW  /Applications/XXX

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libobjc.A.dylib               	0x00007fff829f0103 objc_release + 35
1   libobjc.A.dylib               	0x00007fff829eeb3b (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 477
2   com.apple.CoreFoundation      	0x00007fff84b67c12 _CFAutoreleasePoolPop + 50
3   com.apple.Foundation          	0x00007fff8b2f09ea -[NSAutoreleasePool drain] + 153
4   com.apple.AppKit              	0x00007fff900ffe53 -[NSApplication run] + 893
5   com.xojo.XojoFramework        	0x000000010af5984d RuntimeRun + 42
6   com.XXX.XXX	0x00000001053725c3 REALbasic._RuntimeRun + 19
7   com.XXX.XXX	0x0000000109d87d08 _Main + 536
8   com.XXX.XXX	0x0000000109d7ec83 main + 19
9   libdyld.dylib                 	0x00007fff850d75ad start + 1

Thread 1:: Dispatch queue: com.apple.libdispatch-manager
0   libsystem_kernel.dylib        	0x00007fff85124efa kevent_qos + 10
1   libdispatch.dylib             	0x00007fff98acb165 _dispatch_mgr_invoke + 216
2   libdispatch.dylib             	0x00007fff98acadcd _dispatch_mgr_thread + 52

Thread 2:: com.apple.NSEventThread
0   libsystem_kernel.dylib        	0x00007fff8511df72 mach_msg_trap + 10
1   libsystem_kernel.dylib        	0x00007fff8511d3b3 mach_msg + 55
2   com.apple.CoreFoundation      	0x00007fff84ba91c4 __CFRunLoopServiceMachPort + 212
3   com.apple.CoreFoundation      	0x00007fff84ba868c __CFRunLoopRun + 1356
4   com.apple.CoreFoundation      	0x00007fff84ba7ed8 CFRunLoopRunSpecific + 296
5   com.apple.AppKit              	0x00007fff90261d95 _NSEventThread + 149
6   libsystem_pthread.dylib       	0x00007fff82de899d _pthread_body + 131
7   libsystem_pthread.dylib       	0x00007fff82de891a _pthread_start + 168
8   libsystem_pthread.dylib       	0x00007fff82de6351 thread_start + 13

Thread 3:
0   libsystem_kernel.dylib        	0x00007fff851245e2 __workq_kernreturn + 10
1   libsystem_pthread.dylib       	0x00007fff82de8578 _pthread_wqthread + 1283
2   libsystem_pthread.dylib       	0x00007fff82de6341 start_wqthread + 13

Thread 4:: com.apple.coreaudio.AQClient
0   libsystem_kernel.dylib        	0x00007fff8511df72 mach_msg_trap + 10
1   libsystem_kernel.dylib        	0x00007fff8511d3b3 mach_msg + 55
2   com.apple.CoreFoundation      	0x00007fff84ba91c4 __CFRunLoopServiceMachPort + 212
3   com.apple.CoreFoundation      	0x00007fff84ba868c __CFRunLoopRun + 1356
4   com.apple.CoreFoundation      	0x00007fff84ba7ed8 CFRunLoopRunSpecific + 296
5   com.apple.audio.toolbox.AudioToolbox	0x00007fff881fdeb2 GenericRunLoopThread::Entry(void*) + 194
6   com.apple.audio.toolbox.AudioToolbox	0x00007fff881fdd3e CAPThread::Entry(CAPThread*) + 80
7   libsystem_pthread.dylib       	0x00007fff82de899d _pthread_body + 131
8   libsystem_pthread.dylib       	0x00007fff82de891a _pthread_start + 168
9   libsystem_pthread.dylib       	0x00007fff82de6351 thread_start + 13

Thread 5:
0   libsystem_kernel.dylib        	0x00007fff851245e2 __workq_kernreturn + 10
1   libsystem_pthread.dylib       	0x00007fff82de8578 _pthread_wqthread + 1283
2   libsystem_pthread.dylib       	0x00007fff82de6341 start_wqthread + 13

Thread 6:
0   libsystem_kernel.dylib        	0x00007fff851245e2 __workq_kernreturn + 10
1   libsystem_pthread.dylib       	0x00007fff82de8578 _pthread_wqthread + 1283
2   libsystem_pthread.dylib       	0x00007fff82de6341 start_wqthread + 13

Thread 7:
0   libsystem_kernel.dylib        	0x00007fff851245e2 __workq_kernreturn + 10
1   libsystem_pthread.dylib       	0x00007fff82de8578 _pthread_wqthread + 1283
2   libsystem_pthread.dylib       	0x00007fff82de6341 start_wqthread + 13

Thread 8:: AQConverterThread
0   libsystem_kernel.dylib        	0x00007fff85123db6 __psynch_cvwait + 10
1   libsystem_pthread.dylib       	0x00007fff82de9728 _pthread_cond_wait + 767
2   com.apple.audio.toolbox.AudioToolbox	0x00007fff882250a0 CAGuard::Wait() + 52
3   com.apple.audio.toolbox.AudioToolbox	0x00007fff88221ba4 AQConverterManager::AQConverterThread::Run() + 288
4   com.apple.audio.toolbox.AudioToolbox	0x00007fff88221a7a AQConverterManager::AQConverterThread::ConverterThreadEntry(void*) + 22
5   com.apple.audio.toolbox.AudioToolbox	0x00007fff881fdd3e CAPThread::Entry(CAPThread*) + 80
6   libsystem_pthread.dylib       	0x00007fff82de899d _pthread_body + 131
7   libsystem_pthread.dylib       	0x00007fff82de891a _pthread_start + 168
8   libsystem_pthread.dylib       	0x00007fff82de6351 thread_start + 13

Thread 9:: com.apple.audio.IOThread.client
0   libsystem_kernel.dylib        	0x00007fff8511df72 mach_msg_trap + 10
1   libsystem_kernel.dylib        	0x00007fff8511d3b3 mach_msg + 55
2   com.apple.audio.CoreAudio     	0x00007fff868a435e HALB_MachPort::SendMessageWithReply(unsigned int, unsigned int, unsigned int, unsigned int, mach_msg_header_t*, bool, unsigned int) + 98
3   com.apple.audio.CoreAudio     	0x00007fff868a42ec HALB_MachPort::SendSimpleMessageWithSimpleReply(unsigned int, unsigned int, int, int&, bool, unsigned int) + 42
4   com.apple.audio.CoreAudio     	0x00007fff868a26a9 HALC_ProxyIOContext::IOWorkLoop() + 1149
5   com.apple.audio.CoreAudio     	0x00007fff868a215e HALC_ProxyIOContext::IOThreadEntry(void*) + 88
6   com.apple.audio.CoreAudio     	0x00007fff868a2033 HALB_IOThread::Entry(void*) + 75
7   libsystem_pthread.dylib       	0x00007fff82de899d _pthread_body + 131
8   libsystem_pthread.dylib       	0x00007fff82de891a _pthread_start + 168
9   libsystem_pthread.dylib       	0x00007fff82de6351 thread_start + 13

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x0000000000000000  rbx: 0x00007fc25bf07010  rcx: 0x0000000000000000  rdx: 0x0000000002d49700
  rdi: 0x00007fc25d51e510  rsi: 0x000000010b3e8a00  rbp: 0x00007fff5aa086a0  rsp: 0x00007fff5aa086a0
   r8: 0x0000000000000006   r9: 0x00007fc25d537d10  r10: 0x000000004f8ce59c  r11: 0x00007fc25d500000
  r12: 0xa3a3a3a3a3a3a3a3  r13: 0xc5007ca303fc0c41  r14: 0x00007fc25b00b038  r15: 0x00007fc25b00b000
  rip: 0x00007fff829f0103  rfl: 0x0000000000010246  cr2: 0x0000000000000020
  
Logical CPU:     2
Error Code:      0x00000004
Trap Number:     14

[code]
Process: XXX [913]
Path: XXX
Identifier: com.XXX.XXX
Version: 13.9.2 (13.9.2.2.62)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: XXX [913]
User ID: 502

Date/Time: 2019-05-25 08:55:26.813 -0600
OS Version: Mac OS X 10.11.6 (15G31)
Report Version: 11
Anonymous UUID: E1A41487-F4F8-DE38-6FD8-794862929101

Sleep/Wake UUID: 56905520-FC16-4245-8227-B1761111F8E2

Time Awake Since Boot: 24000 seconds
Time Since Wake: 3300 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:
abort() called
*** error for object 0x7fb6aeb6b350: incorrect checksum for freed object - object was probably modified after being freed.

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fff8d13df06 __pthread_kill + 10
1 libsystem_pthread.dylib 0x00007fff8ae054ec pthread_kill + 90
2 libsystem_c.dylib 0x00007fff92cd86df abort + 129
3 libsystem_malloc.dylib 0x00007fff8ea29396 szone_error + 626
4 libsystem_malloc.dylib 0x00007fff8ea1f5f4 tiny_free_list_remove_ptr + 289
5 libsystem_malloc.dylib 0x00007fff8ea1d946 szone_free_definite_size + 1480
6 com.xojo.XojoFramework 0x000000010eccc554 checkBoxDestructor + 78
7 com.XXX.XXX 0x00000001090aeba4 CheckBox.__Exit%%o + 36
8 com.xojo.XojoFramework 0x000000010ed46c83 RuntimeUnlockObject + 815
9 com.xojo.XojoFramework 0x000000010ec4e2b8 RuntimePaneDelegate::~RuntimePaneDelegate() + 28
10 com.xojo.XojoFramework 0x000000010ec4e2da RuntimePaneDelegate::~RuntimePaneDelegate() + 14
11 com.xojo.XojoFramework 0x000000010ec4e413 RuntimePaneDelegate::PaneClosing(Pane*) + 71
12 com.xojo.XojoFramework 0x000000010ed81731 SubPane::Close() + 173
13 com.xojo.XojoFramework 0x000000010ed817ed SubPane::Unlock() + 143
14 com.xojo.XojoFramework 0x000000010ec4de52 RuntimeView::UnifiedClose(bool) + 574
15 com.xojo.XojoFramework 0x000000010ed43b95 RuntimeCloseWindow + 16
16 com.XXX.XXX 0x000000010900ffa4 Window.Close%%o + 36
17 com.XXX.XXX 0x0000000109ece19c WINDOW1.WINDOW1.redefaultsettings%%o<WINDOW1.WINDOW1> + 14364
18 com.XXX.XXX 0x000000010973fdd6 WINDOW1.WINDOW1.TabPanel1_Change%%o<WINDOW1.WINDOW1>o + 1798
19 com.XXX.XXX 0x0000000109fa43e4 Delegate.IM_Invoke%%o + 52
20 com.XXX.XXX 0x0000000109577a14 AddHandler.Stub.15%% + 52
21 com.XXX.XXX 0x00000001090bf011 PagePanel.Value.Set%%oi4i8 + 49
22 com.XXX.XXX 0x000000010996716e WINDOW1.WINDOW1.Canvas48_Change%%o<WINDOW1.WINDOW1>o + 894
23 com.XXX.XXX 0x0000000109fa5f04 Delegate.IM_Invoke%%o + 52
24 com.XXX.XXX 0x0000000109fa4b54 AddHandler.Stub.26%% + 52
25 com.XXX.XXX 0x000000010cb9f154 TabControlCanvas.Event_MouseUp%%oi8i8 + 4388
26 com.xojo.XojoFramework 0x000000010ec42fde RuntimeCanvas::HandleMouseUp(xojo::Valuexojo::Points, xojo::Valuexojo::Points) + 106
27 com.xojo.XojoFramework 0x000000010ebd35f6 0x10eaea000 + 955894
28 com.xojo.XojoFramework 0x000000010ebce83b 0x10eaea000 + 935995
29 com.apple.AppKit 0x00007fff988f2713 -[NSWindow _handleMouseUpEvent:isDelayedEvent:] + 119
30 com.apple.AppKit 0x00007fff988f33ad -[NSWindow _reallySendEvent:isDelayedEvent:] + 212
31 com.apple.AppKit 0x00007fff98332539 -[NSWindow sendEvent:] + 517
32 com.xojo.XojoFramework 0x000000010ebcf861 0x10eaea000 + 940129
33 com.apple.AppKit 0x00007fff982b2a38 -[NSApplication sendEvent:] + 2540
34 com.xojo.XojoFramework 0x000000010ebbf267 0x10eaea000 + 873063
35 com.XXX.XXX 0x000000010906a3a5 Application._CallFunctionWithExceptionHandling%%op + 181
36 com.xojo.XojoFramework 0x000000010ed444db CallFunctionWithExceptionHandling(void (*)()) + 262
37 com.xojo.XojoFramework 0x000000010ebbf1e2 0x10eaea000 + 872930
38 com.apple.AppKit 0x00007fff98119df2 -[NSApplication run] + 796
39 com.xojo.XojoFramework 0x000000010ed4284d RuntimeRun + 42
40 com.XXX.XXX 0x000000010915d5c3 REALbasic._RuntimeRun + 19
41 com.XXX.XXX 0x000000010db72d08 _Main + 536
42 com.XXX.XXX 0x000000010db69c83 main + 19
43 libdyld.dylib 0x00007fff8d0f15ad start + 1

Thread 1:: Dispatch queue: com.apple.libdispatch-manager
0 libsystem_kernel.dylib 0x00007fff8d13eefa kevent_qos + 10
1 libdispatch.dylib 0x00007fffa0ae5165 _dispatch_mgr_invoke + 216
2 libdispatch.dylib 0x00007fffa0ae4dcd _dispatch_mgr_thread + 52

Thread 2:: com.apple.NSEventThread
0 libsystem_kernel.dylib 0x00007fff8d137f72 mach_msg_trap + 10
1 libsystem_kernel.dylib 0x00007fff8d1373b3 mach_msg + 55
2 com.apple.CoreFoundation 0x00007fff8cbc31c4 __CFRunLoopServiceMachPort + 212
3 com.apple.CoreFoundation 0x00007fff8cbc268c __CFRunLoopRun + 1356
4 com.apple.CoreFoundation 0x00007fff8cbc1ed8 CFRunLoopRunSpecific + 296
5 com.apple.AppKit 0x00007fff9827bd95 _NSEventThread + 149
6 libsystem_pthread.dylib 0x00007fff8ae0299d _pthread_body + 131
7 libsystem_pthread.dylib 0x00007fff8ae0291a _pthread_start + 168
8 libsystem_pthread.dylib 0x00007fff8ae00351 thread_start + 13

Thread 3:: com.apple.coreaudio.AQClient
0 libsystem_kernel.dylib 0x00007fff8d137f72 mach_msg_trap + 10
1 libsystem_kernel.dylib 0x00007fff8d1373b3 mach_msg + 55
2 com.apple.CoreFoundation 0x00007fff8cbc31c4 __CFRunLoopServiceMachPort + 212
3 com.apple.CoreFoundation 0x00007fff8cbc268c __CFRunLoopRun + 1356
4 com.apple.CoreFoundation 0x00007fff8cbc1ed8 CFRunLoopRunSpecific + 296
5 com.apple.audio.toolbox.AudioToolbox 0x00007fff90217eb2 GenericRunLoopThread::Entry(void*) + 194
6 com.apple.audio.toolbox.AudioToolbox 0x00007fff90217d3e CAPThread::Entry(CAPThread*) + 80
7 libsystem_pthread.dylib 0x00007fff8ae0299d _pthread_body + 131
8 libsystem_pthread.dylib 0x00007fff8ae0291a _pthread_start + 168
9 libsystem_pthread.dylib 0x00007fff8ae00351 thread_start + 13

Thread 4:
0 libsystem_kernel.dylib 0x00007fff8d13e5e2 __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x00007fff8ae02578 _pthread_wqthread + 1283
2 libsystem_pthread.dylib 0x00007fff8ae00341 start_wqthread + 13

Thread 5:
0 libsystem_kernel.dylib 0x00007fff8d13e5e2 __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x00007fff8ae02578 _pthread_wqthread + 1283
2 libsystem_pthread.dylib 0x00007fff8ae00341 start_wqthread + 13

Thread 6:
0 libsystem_kernel.dylib 0x00007fff8d13e5e2 __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x00007fff8ae02578 _pthread_wqthread + 1283
2 libsystem_pthread.dylib 0x00007fff8ae00341 start_wqthread + 13

Thread 7:

Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x0000000000000000 rbx: 0x0000000000000006 rcx: 0x00007fff56c1be88 rdx: 0x0000000000000000
rdi: 0x000000000000160b rsi: 0x0000000000000006 rbp: 0x00007fff56c1beb0 rsp: 0x00007fff56c1be88
r8: 0x00000000fffffff0 r9: 0x0000000000000010 r10: 0x0000000008000000 r11: 0x0000000000000206
r12: 0x0000000000000001 r13: 0x00000001146f9000 r14: 0x00007fff7a633000 r15: 0x000000010eae6000
rip: 0x00007fff8d13df06 rfl: 0x0000000000000206 cr2: 0x00007fff7c671008

Logical CPU: 0
Error Code: 0x02000148
Trap Number: 133[/code]

Norman will probably have more insight, but the numerous mentions of the thread in the crash report lean in favor of the hypothesis I posted above, a thread that is not finished when the window closes.