Repository navigation
fix(viewer): destroy the Qt objects before interpreter exit - #59
Merged
Merged
Conversation
Every quit of the Console Hub ended in a segfault or a 'corrupted double-linked list' abort. PySide's interpreter-exit cleanup (PySide::destroyQCoreApplication -> visitAllPyObjects) destroys a QObject that was already gone, leaving a ~13 MB core dump each time. Capture has already shut down cleanly by then, so nothing is lost apart from the core dump. After app.exec() returns, hide the tray icon and window, delete the window through the event loop, and flush the deferred deletes while Python still owns the objects. Then exit. Reproduced off-screen (QT_QPA_PLATFORM=offscreen, quitting through the tray Quit path after 4 s): 3/3 crashes before, 5/5 clean exits after, plus 2/2 clean exits when started with --tray.
Owner
|
Thank you for tracking down this shutdown crash! We tested this locally with the viewer: exiting via both the window close button and the system tray now terminates the application cleanly without leaving any double-linked list aborts or core dumps behind. Merged into dev. Really appreciate your help with keeping the desktop app stable and polished! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix Console Hub crash on exit
Problem
Every quit of the Console Hub ended in a segfault, or a
corrupted double-linked listabort, and left a ~13 MB core dump. Capture had already shut down cleanly by then, so nothing was lost apart from the core dump.PySide's interpreter-exit cleanup destroys a QObject that has already been destroyed.
Fix
Once
app.exec()returns,main()calls a new_destroy_qt_objects(). It hides the tray icon and window, deletes the window through the event loop and flushes the deferred deletes while Python still owns the objects. Then it exits with the same code as before.Testing
QT_QPA_PLATFORM=offscreen, running the real viewer and quitting through the tray Quit path (_force_quit) after 4 s: 3/3 crashes before, 5/5 clean exits after, plus 2/2 clean exits when started with--tray.