maxempoint / AR_GBX

Python Framework for interacting with the Action Replay GBX
GNU General Public License v3.0
0 stars 1 forks source link

tkinter crashes on macOS #12

Open philippfriese opened 2 years ago

philippfriese commented 2 years ago

On macOS (12.4), the tkinter call self.root = tk.Tk() (here) crashes. The crashlog is appended below.

This stackoverflow article (and others) mention that tkinter expects to be launched from the main thread. On macOS, not abiding to this expectation apparently results in an application crash.

Hotfix: Launch the GUI on the main thread. Recommended fix:

INFO:root:Export in Control new_mod_data.dat
INFO:root:Import in Control tests/test_data.dat
INFO:root:Export in Model new_mod_data.dat
INFO:root:Import in Model tests/test_data.dat
INFO:root:Export in PythonDriver new_mod_data.dat
INFO:root:Import in PythonDriver tests/test_data.dat
2022-06-26 09:42:16.005 Python[2592:8285760] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSWindow drag regions should only be invalidated on the Main Thread!'
*** First throw call stack:
(
    0   CoreFoundation                      0x00000001b63c9198 __exceptionPreprocess + 240
    1   libobjc.A.dylib                     0x00000001b6113e04 objc_exception_throw + 60
    2   CoreFoundation                      0x00000001b63f4118 _CFBundleGetValueForInfoKey + 0
    3   AppKit                              0x00000001b8ed6ba0 -[NSWindow(NSWindow_Theme) _postWindowNeedsToResetDragMarginsUnlessPostingDisabled] + 372
    4   AppKit                              0x00000001b8ec1b9c -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 948
    5   AppKit                              0x00000001b8ec17dc -[NSWindow initWithContentRect:styleMask:backing:defer:] + 56
    6   libtk8.6.dylib                      0x000000011ca37798 TkMacOSXMakeRealWindowExist + 540
    7   libtk8.6.dylib                      0x000000011ca37468 TkWmMapWindow + 56
    8   libtk8.6.dylib                      0x000000011c9a0f70 Tk_MapWindow + 152
    9   libtk8.6.dylib                      0x000000011c9a92dc MapFrame + 76
    10  libtcl8.6.dylib                     0x000000011c8dd5ac TclServiceIdle + 84
    11  libtcl8.6.dylib                     0x000000011c8c1c68 Tcl_DoOneEvent + 296
    12  libtk8.6.dylib                      0x000000011ca2a97c TkpInit + 792
    13  libtk8.6.dylib                      0x000000011c9a2228 Initialize + 2292
    14  _tkinter.cpython-310-darwin.so      0x000000010509aa98 Tcl_AppInit + 80
    15  _tkinter.cpython-310-darwin.so      0x00000001050950ec Tkapp_New + 592
    16  _tkinter.cpython-310-darwin.so      0x0000000105094aac _tkinter_create + 580
    17  Python                              0x000000010335ce98 cfunction_vectorcall_FASTCALL + 88
    18  Python                              0x0000000103405854 call_function + 128
    19  Python                              0x0000000103400404 _PyEval_EvalFrameDefault + 32836
    20  Python                              0x00000001033f70ec _PyEval_Vector + 328
    21  Python                              0x0000000103309bb4 _PyObject_FastCallDictTstate + 96
    22  Python                              0x0000000103380630 slot_tp_init + 196
    23  Python                              0x0000000103378968 type_call + 288
    24  Python                              0x000000010330994c _PyObject_MakeTpCall + 136
    25  Python                              0x00000001034058e4 call_function + 272
    26  Python                              0x0000000103400404 _PyEval_EvalFrameDefault + 32836
    27  Python                              0x00000001033f70ec _PyEval_Vector + 328
    28  Python                              0x0000000103405854 call_function + 128
    29  Python                              0x0000000103400384 _PyEval_EvalFrameDefault + 32708
    30  Python                              0x00000001033f70ec _PyEval_Vector + 328
    31  Python                              0x000000010330ccd0 method_vectorcall + 388
    32  Python                              0x00000001034005ec _PyEval_EvalFrameDefault + 33324
    33  Python                              0x00000001033f70ec _PyEval_Vector + 328
    34  Python                              0x0000000103405854 call_function + 128
    35  Python                              0x0000000103400384 _PyEval_EvalFrameDefault + 32708
    36  Python                              0x00000001033f70ec _PyEval_Vector + 328
    37  Python                              0x0000000103405854 call_function + 128
    38  Python                              0x0000000103400384 _PyEval_EvalFrameDefault + 32708
    39  Python                              0x00000001033f70ec _PyEval_Vector + 328
    40  Python                              0x000000010330ccd0 method_vectorcall + 388
    41  Python                              0x00000001034bf05c thread_run + 120
    42  Python                              0x00000001034611dc pythread_wrapper + 48
    43  libsystem_pthread.dylib             0x00000001b627c26c _pthread_start + 148
    44  libsystem_pthread.dylib             0x00000001b627708c thread_start + 8
)
libc++abi: terminating with uncaught exception of type NSException