It seems to be happening when the EVENT handler loop has finished and is waiting at SelectEvent(). Reading this Apple Developer Technical Note, the crash seems to be because of the following...
According to this document the next part of the report backtraces the functions (where function 0 is the one that crashed). It looks like it is the garbage collector that is crashing when it's trying to clear-up a recently free'd window:
Winni: Maybe because of this, I should post this in the Bug Reports afterall? Anyone any other ideas/comments?
Update: I've tried adding GCSetMode(2) to prevent automatic garbage collection but it still chokes at WaitEvent().
EXC_BAD_ACCESS/KERN_INVALID_ADDRESS — This is caused by the thread accessing unmapped memory. It may be triggered by either a data access or an instruction fetch; I describe how to tell the difference in a later section.
According to this document the next part of the report backtraces the functions (where function 0 is the one that crashed). It looks like it is the garbage collector that is crashing when it's trying to clear-up a recently free'd window:
1 com.apple.AppKit 0x9373993c -[NSWindow _setWindowNumber:] + 276
2 com.apple.AppKit 0x937aa970 -[NSWindow _termWindowIfOwner] + 144
3 com.apple.AppKit 0x937a99e8 -[NSWindow dealloc] + 860
4 com.apple.Foundation 0x9291c968 NSPopAutoreleasePool + 536
5 Max'dGUI 0x00002fac bbFlushAutoreleasePool + 44 (crt.c:355)
6 Max'dGUI 0x00099c40 bbSystemWait + 48 (crt.c:355)
7 Max'dGUI 0x0009a984 _brl_system_TMacOSSystemDriver_Wait + 28
2 com.apple.AppKit 0x937aa970 -[NSWindow _termWindowIfOwner] + 144
3 com.apple.AppKit 0x937a99e8 -[NSWindow dealloc] + 860
4 com.apple.Foundation 0x9291c968 NSPopAutoreleasePool + 536
5 Max'dGUI 0x00002fac bbFlushAutoreleasePool + 44 (crt.c:355)
6 Max'dGUI 0x00099c40 bbSystemWait + 48 (crt.c:355)
7 Max'dGUI 0x0009a984 _brl_system_TMacOSSystemDriver_Wait + 28
Winni: Maybe because of this, I should post this in the Bug Reports afterall? Anyone any other ideas/comments?
Update: I've tried adding GCSetMode(2) to prevent automatic garbage collection but it still chokes at WaitEvent().