Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Window modal dialog crash on Cancel on Win platform PyQt
bootchk last edited by
For a windows modal dialog, when user chooses Cancel, app sometimes crashes with 'QThread: Destroyed while thread is still running' on the console.
On Windows Vista, PyQt5, Qt5.x. On other platforms, it does not seem to crash.
I tried call dialog.setAttribute(Qt::WA_DeleteOnClose). This somewhat helps: user must cancel several times in succession. It still prints 'QThread: ...' each time, but doesn't reliably crash. Finally Qt posts something about killing QTimer from another thread and does crash.
I suppose it could be a PyQt problem. The dialog is a local variable of a method. I suppose I should make it an instance variable of some object that persists.
I don't understand why QThread is involved. It seems to me that the event loop for the window modal dialog should be in the same thread as the rest of the app. Maybe the design has changed for Qt5 or the design is different for the Win platform?