Skip to content

Release the closed main window as singleton instance - #11

Merged
PierreRaybaut merged 1 commit into
developfrom
fix/release-closed-main-window
Oct 20, 2026
Merged

PierreRaybaut merged 1 commit into
developfrom
fix/release-closed-main-window

Conversation

@PierreRaybaut

Copy link
Copy Markdown
Contributor

SGMXMainWindow.get_instance returned 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

  • A main window closed for good (i.e. not only hidden, see hide_on_close) is no longer the singleton instance: get_instance then creates a new window. A hidden window is still returned by get_instance.
  • New test 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").
  • Release note (with French translation).

The DataLab counterpart uses the same branch name, so that DataLab CI tests both changes together.

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
@PierreRaybaut
PierreRaybaut merged commit 4792f98 into develop Oct 20, 2026
8 checks passed
@PierreRaybaut
PierreRaybaut deleted the fix/release-closed-main-window branch October 23, 2026 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant