Skip to content

segfault during exit #74

@chrisjbillington

Description

@chrisjbillington

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 two QApplication 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:

qapplication = QtWidgets.QApplication.instance()
if qapplication is None:
    qapplication = QtWidgets.QApplication(sys.argv)

to use the process-wide QApplication singleton if it already exists. The splash screen code is already doing this, so the resulting QApplication will have had sys.argv passed to it regardless of who initialised it.

I wonder if this could be responsible for segfaults at startup we sometimes hear about

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions