Repository navigation
Release the closed main window as singleton instance - #11
Merged
Merged
Conversation
The instance returned by `get_instance` kept a closed main window alive, with all its widgets and data, until another main window was created. In test suites, the previous window was therefore destroyed by the garbage collector at an arbitrary point of the next test. A main window closed for good (i.e. not only hidden, see `hide_on_close`) is no longer the singleton instance: `get_instance` creates a new window. Assisted-by: Claude Opus 5.5
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.
SGMXMainWindow.get_instancereturned a module-level singleton that kept a main window alive after it was closed, with all its widgets and data, until another main window was created.Why it matters
In application test suites (e.g. DataLab), each test creates and closes a main window: the window of a test was only released while the next test created its own, then destroyed by the garbage collector at an arbitrary point of that next test, possibly amid Qt operations. This is investigated as a possible cause of intermittent segmentation faults in DataLab CI (see DataLab-Platform/DataLab#405).
Change
hide_on_close) is no longer the singleton instance:get_instancethen creates a new window. A hidden window is still returned byget_instance.test_get_instance_after_close: a hidden window remains the instance, and a closed one is garbage collected (it fails without the fix: "Closed window is still alive").The DataLab counterpart uses the same branch name, so that DataLab CI tests both changes together.