Hard Crash Help

Any idea where I might look for this hard crash?

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

Exception Type:        EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes:       0x0000000000000001, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Illegal instruction: 4
Termination Reason:    Namespace SIGNAL, Code 0x4
Terminating Process:   exc handler [67833]

Application Specific Information:
Crashing on exception: -[NSApplication runModalSession:] may not be invoked inside of transaction begin/commit pair, or inside of transaction commit (usually this means it was invoked inside of a view's -drawRect: method.)

Application Specific Backtrace 1:
0   CoreFoundation                      0x00007fff305acb57 __exceptionPreprocess + 250
1   libobjc.A.dylib                     0x00007fff6941f5bf objc_exception_throw + 48
2   CoreFoundation                      0x00007fff305ac9b5 +[NSException raise:format:] + 189
3   AppKit                              0x00007fff2e035307 _NSRunModal + 152
4   AppKit                              0x00007fff2dc34320 -[NSApplication runModalSession:] + 241
5   XojoFramework                       0x00000001088060e6 _Z11ModalEventsh + 58
6   XojoFramework                       0x0000000108819578 RuntimeShowModalWithinWindow + 457
7   Cargo Australia.debug               0x00000001081463a4 Window.ShowModal%%o<Window> + 36
8   Cargo Australia.debug               0x00000001082d5e1d GameWnd.GameWnd.CheckPort%%o<GameWnd.GameWnd> + 73805
9   Cargo Australia.debug               0x00000001082ed6d2 GameWnd.GameWnd.Moveship%%o<GameWnd.GameWnd> + 37538
10  Cargo Australia.debug               0x000000010829e92e GameWnd.GameWnd.Canvas1_Paint%%o<GameWnd.GameWnd>o<Canvas>o<Graphics>A1o<REALbasic.Rect> + 2574
11  Cargo Australia.debug               0x000000010831fcb4 Delegate.IM_Invoke%%o<Canvas>o<Graphics>A1o<REALbasic.Rect> + 68
12  Cargo Australia.debug               0x000000010831fd2e AddHandler.Stub.24%%o<Graphics>A1o<REALbasic.Rect> + 94
13  XojoFramework                       0x00000001087031f0 _ZN13RuntimeCanvas6RedrawEP8GraphicsRKNSt3__16vectorIN4xojo4RectINS4_6PointsEEENS2_9allocatorIS7_EEEE + 864
14  XojoFramework                       0x0000000108698f82 _Z31Debugger_DictionaryValueByIndexP13RuntimeObjectx + 12981
15  AppKit                              0x00007fff2d92c59f _NSViewDrawRect + 139
16  AppKit                              0x00007fff2d92b8ae -[NSView(NSInternal) _recursive:displayRectIgnoringOpacity:inContext:stopAtLayerBackedViews:] + 2170
17  AppKit                              0x00007fff2d92acaa -[NSView(NSLayerKitGlue) _drawViewBackingLayer:inContext:drawingHandler:] + 1271
18  QuartzCore                          0x00007fff3c02386d CABackingStoreUpdate_ + 595
19  QuartzCore                          0x00007fff3c0834ad ___ZN2CA5Layer8display_Ev_block_invoke + 53
20  QuartzCore                          0x00007fff3c022d86 -[CALayer _display] + 2103
21  AppKit                              0x00007fff2d92a69a -[_NSBackingLayer display] + 537
22  AppKit                              0x00007fff2d88c187 -[_NSViewBackingLayer display] + 800

Are you showing a window modally from inside a paint Event? What is done in CheckPort?

2 Likes

Since a few versions of macOS, the system causes this exception if you open a window within a paint event.

1 Like

Yes. Checkport monitors an object moving in an animation for a collision or reaching a point which triggers another window. If I do Wnd.show its fine but if I do Wnd.showmodal it crashes.
Should it trigger a timer that shows the window. It doesn’t actually have Wnd.showmodal in the paint event its in a method outside the event

feedback://showreport?report_id=63682 is already reproduced.

1 Like

That doesn’t matter. The method where you open the window is called as a result of the paint event.

Paint calls MoveShip
MoveShip calls CheckPort
CheckPort opens the window.

That’s the same as opening the window in the event.

4 Likes

Is it okay to use a single timer to open the window modally? It seems to work but just wondering if that is correct.

Or just CallLater

1 Like
Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.