Closed chrisjbillington closed 4 years ago
Yes we should absolutely only be creating one QApplication object. Pretty sure I've answered similar questions on stack overflow before (about random segfaults).
The Qt docs also state this:
Only one application object should be created.
Great. I'll fix this in each app to fix the bug and as a step toward PySide2 compatibility.
I'm getting a segfault at exit on Linux.
I tracked it down to an
atexit
function added by PyQt, and on a hunch guessed that it might be due to us having twoQApplication
objects in the interpreter - one for the splash screen and one for runmanager itself. Recently when testing under PySide2 I discovered this is not allowed in PySide2, and I'm pretty sure it shouldn't be allowed anywhere.Turns out using the
QApplication
that already exists makes the segfault go away. So we should do this in runmanager and the other GUI apps:to use the process-wide
QApplication
singleton if it already exists. The splash screen code is already doing this, so the resultingQApplication
will have hadsys.argv
passed to it regardless of who initialised it.I wonder if this could be responsible for segfaults at startup we sometimes hear about