[PyQt] SEGV on exit but only with ALT-F4

Barry Scott barry at barrys-emacs.org
Sun Mar 20 16:20:30 GMT 2016

I have been reading about the issue of atexit handlers deleting Qt objects in 
a random order, causing SEGV.

I use this pattern to start up my application:

def main( argv ):
    app = wb_git_app.WbGit_App( argv )
    rc = app.exec_()
    # force clean up of objects to avoid segv on exit
    del app
    return rc

if __name__ == '__main__':
    sys.exit( main( sys.argv ) )

All the PyQt work in in WbGit_App object and its children.

All is well if I exit from an menu action or clicking the [X] on the window 
decoration to exit. But type Alt-F4 and I get a SEGV.

I have two questions:

1) How can I track down the orphaned Qt objects to try and delete them
in predicable order?

2) What is different about Alt-F4 method of quitting? (Maybe I can figure
why it crashes from that difference)


More information about the PyQt mailing list