CompuCell3D / cc3d-player5

CC3D Player 5
GNU Lesser General Public License v3.0
4 stars 4 forks source link

Bugfix: Graceful exit when closing Player #53

Open fyffep opened 7 months ago

fyffep commented 7 months ago

This fixes the error QThread: Destroyed while thread is still running that occurred in the following situation:

  1. Start a simulation (either through the Play button or the Step button)
  2. Rather than clicking Stop, hit the X to close the Player window
maciekswat commented 7 months ago

On OSX I am getting segfault with this branch

GOT CUSTOM SETTINGS :  /Users/m/src/Demos-local/Models/cellsort/cellsort_2D/Simulation/_settings.sqlite
key, win =  (0, <cc3d.player5.Plugins.ViewManagerPlugins.MainArea.SubWindow object at 0x143832200>)
key, win =  (1, <cc3d.player5.Plugins.ViewManagerPlugins.MainArea.SubWindow object at 0x143830040>)
plot manager does not have plotWindowList member

Process finished with exit code 139 (interrupted by signal 11:SIGSEGV)

and the stacktrace is


Time Awake Since Boot: 6600 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 0x000000000000000c
Exception Codes:       0x0000000000000001, 0x000000000000000c

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

VM Region Info: 0xc is not in any region.  Bytes before following region: 4296409076
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      UNUSED SPACE AT START
--->  
      __TEXT                      100160000-10046c000    [ 3120K] r-x/r-x SM=COW  /Users/USER/*/python3.10

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   libQt5Core.5.15.8.dylib                0x109413f18 QBasicMutex::unlockInternal() + 20
1   libQt5Core.5.15.8.dylib                0x109413c80 QMutex::unlock() + 48
2   python3.10                             0x10021a424 cfunction_call + 204
3   python3.10                             0x1001c1338 _PyObject_MakeTpCall + 332
4   python3.10                             0x1002d04ec call_function + 732
5   python3.10                             0x1002cc574 _PyEval_EvalFrameDefault + 31656
6   python3.10                             0x1002c4184 _PyEval_Vector + 2588
7   python3.10                             0x1001c4e38 method_vectorcall + 516
8   QtCore.abi3.so                         0x128148130 PyQtSlot::call(_object*, _object*) const + 68
9   QtCore.abi3.so                         0x128147fc0 PyQtSlot::invoke(void**, _object*, void*, bool) const + 324
10  QtCore.abi3.so                         0x128148d38 PyQtSlotProxy::unislot(void**) + 92
11  QtCore.abi3.so                         0x128148ca8 PyQtSlotProxy::qt_metacall(QMetaObject::Call, int, void**) + 68
12  libQt5Core.5.15.8.dylib                0x10953e7d4 0x1093f8000 + 1337300
13  python3.10                             0x1001cfad8 method_vectorcall_VARARGS + 172
14  python3.10                             0x1002d0454 call_function + 580
15  python3.10                             0x1002cc554 _PyEval_EvalFrameDefault + 31624
16  python3.10                             0x1002c4184 _PyEval_Vector + 2588
17  python3.10                             0x1001c4cd8 method_vectorcall + 164
18  python3.10                             0x1002d0454 call_function + 580
19  python3.10                             0x1002cc574 _PyEval_EvalFrameDefault + 31656
20  python3.10                             0x1002c4184 _PyEval_Vector + 2588
21  python3.10                             0x1001c4cd8 method_vectorcall + 164
22  python3.10                             0x1002d0454 call_function + 580
23  python3.10                             0x1002cc574 _PyEval_EvalFrameDefault + 31656
24  python3.10                             0x1002c4184 _PyEval_Vector + 2588
25  python3.10                             0x1001c4e38 method_vectorcall + 516
26  sip.cpython-310-darwin.so              0x11f7697a0 sip_api_call_procedure_method + 116
27  QtWidgets.abi3.so                      0x128f315e8 sipVH_QtWidgets_19(PyGILState_STATE, void (*)(_sipSimpleWrapper*, PyGILState_STATE), _sipSimpleWrapper*, _object*, QCloseEvent*) + 56
28  QtWidgets.abi3.so                      0x129029ad0 sipQMainWindow::closeEvent(QCloseEvent*) + 120
29  libQt5Widgets.5.15.8.dylib             0x1087dc30c QWidget::event(QEvent*) + 104
30  libQt5Widgets.5.15.8.dylib             0x1087b6e58 QApplicationPrivate::notify_helper(QObject*, QEvent*) + 232
31  libQt5Core.5.15.8.dylib                0x109521844 QCoreApplication::notifyInternal2(QObject*, QEvent*) + 176
32  libQt5Core.5.15.8.dylib                0x109521844 QCoreApplication::notifyInternal2(QObject*, QEvent*) + 176
33  AppKit                                 0x1a398ccd4 -[NSWindow __close] + 400
34  AppKit                                 0x1a386dc70 -[NSApplication(NSResponder) sendAction:to:from:] + 460
35  AppKit                                 0x1a386da74 -[NSControl sendAction:to:] + 72
36  AppKit                                 0x1a386d9b8 __26-[NSCell _sendActionFrom:]_block_invoke + 100
37  AppKit                                 0x1a386d8e0 -[NSCell _sendActionFrom:] + 204
38  AppKit                                 0x1a386d804 -[NSButtonCell _sendActionFrom:] + 88
39  AppKit                                 0x1a386ae38 NSControlTrackMouse + 1480
40  AppKit                                 0x1a386a844 -[NSCell trackMouse:inRect:ofView:untilMouseUp:] + 144
41  AppKit                                 0x1a386a6fc -[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:] + 488
42  AppKit                                 0x1a3869bd0 -[NSControl mouseDown:] + 448
43  AppKit                                 0x1a386899c -[NSWindow(NSEventRouting) _handleMouseDownEvent:isDelayedEvent:] + 3472
44  AppKit                                 0x1a37f3f78 -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 364
45  AppKit                                 0x1a37f3c38 -[NSWindow(NSEventRouting) sendEvent:] + 284
46  libqcocoa.dylib                        0x13bc7590c 0x13bc4c000 + 170252
47  libqcocoa.dylib                        0x13bc7a7a4 0x13bc4c000 + 190372
48  AppKit                                 0x1a36bbcdc -[NSApplication run] + 512
49  libqcocoa.dylib                        0x13bc77df0 0x13bc4c000 + 179696
50  python3.10                             0x10021a424 cfunction_call + 204
51  python3.10                             0x1001c1338 _PyObject_MakeTpCall + 332
52  python3.10                             0x1002d04ec call_function + 732
53  python3.10                             0x1002cc574 _PyEval_EvalFrameDefault + 31656
54  python3.10                             0x1002c4184 _PyEval_Vector + 2588
55  python3.10                             0x1002d0454 call_function + 580
56  python3.10                             0x1002cc5e4 _PyEval_EvalFrameDefault + 31768
57  python3.10                             0x1002c4184 _PyEval_Vector + 2588
58  python3.10                             0x10032c378 _PyRun_SimpleFileObject + 1144
59  python3.10                             0x10032b328 _PyRun_AnyFileObject + 232
60  python3.10                             0x100350188 Py_RunMain + 2376
61  python3.10                             0x10035162c pymain_main + 1292
62  python3.10                             0x1001679e0 main + 56
63  dyld                                   0x19fa0a0e0 start + 2360

on develop branch I am getting exit code 255 (not ideal but no segfault)

Normally the exit code should be 0

I will check it on other platforms as well

tjsego commented 6 months ago

On OSX I am getting segfault with this branch

GOT CUSTOM SETTINGS :  /Users/m/src/Demos-local/Models/cellsort/cellsort_2D/Simulation/_settings.sqlite
key, win =  (0, <cc3d.player5.Plugins.ViewManagerPlugins.MainArea.SubWindow object at 0x143832200>)
key, win =  (1, <cc3d.player5.Plugins.ViewManagerPlugins.MainArea.SubWindow object at 0x143830040>)
plot manager does not have plotWindowList member

Process finished with exit code 139 (interrupted by signal 11:SIGSEGV)

and the stacktrace is


Time Awake Since Boot: 6600 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 0x000000000000000c
Exception Codes:       0x0000000000000001, 0x000000000000000c

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

VM Region Info: 0xc is not in any region.  Bytes before following region: 4296409076
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      UNUSED SPACE AT START
--->  
      __TEXT                      100160000-10046c000    [ 3120K] r-x/r-x SM=COW  /Users/USER/*/python3.10

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   libQt5Core.5.15.8.dylib                  0x109413f18 QBasicMutex::unlockInternal() + 20
1   libQt5Core.5.15.8.dylib                  0x109413c80 QMutex::unlock() + 48
2   python3.10                               0x10021a424 cfunction_call + 204
3   python3.10                               0x1001c1338 _PyObject_MakeTpCall + 332
4   python3.10                               0x1002d04ec call_function + 732
5   python3.10                               0x1002cc574 _PyEval_EvalFrameDefault + 31656
6   python3.10                               0x1002c4184 _PyEval_Vector + 2588
7   python3.10                               0x1001c4e38 method_vectorcall + 516
8   QtCore.abi3.so                           0x128148130 PyQtSlot::call(_object*, _object*) const + 68
9   QtCore.abi3.so                           0x128147fc0 PyQtSlot::invoke(void**, _object*, void*, bool) const + 324
10  QtCore.abi3.so                           0x128148d38 PyQtSlotProxy::unislot(void**) + 92
11  QtCore.abi3.so                           0x128148ca8 PyQtSlotProxy::qt_metacall(QMetaObject::Call, int, void**) + 68
12  libQt5Core.5.15.8.dylib                  0x10953e7d4 0x1093f8000 + 1337300
13  python3.10                               0x1001cfad8 method_vectorcall_VARARGS + 172
14  python3.10                               0x1002d0454 call_function + 580
15  python3.10                               0x1002cc554 _PyEval_EvalFrameDefault + 31624
16  python3.10                               0x1002c4184 _PyEval_Vector + 2588
17  python3.10                               0x1001c4cd8 method_vectorcall + 164
18  python3.10                               0x1002d0454 call_function + 580
19  python3.10                               0x1002cc574 _PyEval_EvalFrameDefault + 31656
20  python3.10                               0x1002c4184 _PyEval_Vector + 2588
21  python3.10                               0x1001c4cd8 method_vectorcall + 164
22  python3.10                               0x1002d0454 call_function + 580
23  python3.10                               0x1002cc574 _PyEval_EvalFrameDefault + 31656
24  python3.10                               0x1002c4184 _PyEval_Vector + 2588
25  python3.10                               0x1001c4e38 method_vectorcall + 516
26  sip.cpython-310-darwin.so                0x11f7697a0 sip_api_call_procedure_method + 116
27  QtWidgets.abi3.so                        0x128f315e8 sipVH_QtWidgets_19(PyGILState_STATE, void (*)(_sipSimpleWrapper*, PyGILState_STATE), _sipSimpleWrapper*, _object*, QCloseEvent*) + 56
28  QtWidgets.abi3.so                        0x129029ad0 sipQMainWindow::closeEvent(QCloseEvent*) + 120
29  libQt5Widgets.5.15.8.dylib               0x1087dc30c QWidget::event(QEvent*) + 104
30  libQt5Widgets.5.15.8.dylib               0x1087b6e58 QApplicationPrivate::notify_helper(QObject*, QEvent*) + 232
31  libQt5Core.5.15.8.dylib                  0x109521844 QCoreApplication::notifyInternal2(QObject*, QEvent*) + 176
32  libQt5Core.5.15.8.dylib                  0x109521844 QCoreApplication::notifyInternal2(QObject*, QEvent*) + 176
33  AppKit                                   0x1a398ccd4 -[NSWindow __close] + 400
34  AppKit                                   0x1a386dc70 -[NSApplication(NSResponder) sendAction:to:from:] + 460
35  AppKit                                   0x1a386da74 -[NSControl sendAction:to:] + 72
36  AppKit                                   0x1a386d9b8 __26-[NSCell _sendActionFrom:]_block_invoke + 100
37  AppKit                                   0x1a386d8e0 -[NSCell _sendActionFrom:] + 204
38  AppKit                                   0x1a386d804 -[NSButtonCell _sendActionFrom:] + 88
39  AppKit                                   0x1a386ae38 NSControlTrackMouse + 1480
40  AppKit                                   0x1a386a844 -[NSCell trackMouse:inRect:ofView:untilMouseUp:] + 144
41  AppKit                                   0x1a386a6fc -[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:] + 488
42  AppKit                                   0x1a3869bd0 -[NSControl mouseDown:] + 448
43  AppKit                                   0x1a386899c -[NSWindow(NSEventRouting) _handleMouseDownEvent:isDelayedEvent:] + 3472
44  AppKit                                   0x1a37f3f78 -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 364
45  AppKit                                   0x1a37f3c38 -[NSWindow(NSEventRouting) sendEvent:] + 284
46  libqcocoa.dylib                          0x13bc7590c 0x13bc4c000 + 170252
47  libqcocoa.dylib                          0x13bc7a7a4 0x13bc4c000 + 190372
48  AppKit                                   0x1a36bbcdc -[NSApplication run] + 512
49  libqcocoa.dylib                          0x13bc77df0 0x13bc4c000 + 179696
50  python3.10                               0x10021a424 cfunction_call + 204
51  python3.10                               0x1001c1338 _PyObject_MakeTpCall + 332
52  python3.10                               0x1002d04ec call_function + 732
53  python3.10                               0x1002cc574 _PyEval_EvalFrameDefault + 31656
54  python3.10                               0x1002c4184 _PyEval_Vector + 2588
55  python3.10                               0x1002d0454 call_function + 580
56  python3.10                               0x1002cc5e4 _PyEval_EvalFrameDefault + 31768
57  python3.10                               0x1002c4184 _PyEval_Vector + 2588
58  python3.10                               0x10032c378 _PyRun_SimpleFileObject + 1144
59  python3.10                               0x10032b328 _PyRun_AnyFileObject + 232
60  python3.10                               0x100350188 Py_RunMain + 2376
61  python3.10                               0x10035162c pymain_main + 1292
62  python3.10                               0x1001679e0 main + 56
63  dyld                                     0x19fa0a0e0 start + 2360

on develop branch I am getting exit code 255 (not ideal but no segfault)

Normally the exit code should be 0

I will check it on other platforms as well

Couldn't reproduce this on Windows. Seemed to exit fine.