Skip to content

fix(app): release the engine setup window however it is closed (#666) - #750

Merged
KnifeLemon merged 1 commit into
mainfrom
fix/666-engine-setup-release
Oct 29, 2026
Merged

KnifeLemon merged 1 commit into
mainfrom
fix/666-engine-setup-release

Conversation

@SeoJCalive

Copy link
Copy Markdown
Collaborator

What does this change?

Fixes #666 (item 1 of the findings comment). Closing the engine setup window with the title-bar X (or Alt+F4) left the window and its view model alive, because the view model's handlers on the shared engine packages were only removed by its Close command. The window now releases its view model's package handlers on Closed, so every close route (X, the Later/Done button, Esc) lets the window be collected.

  • EngineSetupViewModel: the unsubscribe loop moved into Release(); the Close command calls it before asking the window to close, as before.
  • EngineSetupWindow: calls Release() on Closed. Releasing twice (command, then Closed) is harmless.
  • I put it on the window rather than in WindowService so windows created directly (the render and zoom tests) are covered too.

Type of change

  • Bug fix
  • New feature or improvement
  • New format or engine
  • Translation
  • Documentation
  • Build, CI or dependencies

How was it tested?

  • dotnet format --verify-no-changes
  • dotnet test: App 1518 passed, 1 failed, 9 skipped; Core 719 passed, on Linux (xvfb). Compared test by test with a run before the change, only the 7 new tests differ. The one App failure, RenderTests.Engines_page_shows_versions_descriptions_and_download_speed, also fails on main on this machine (system gs/soffice versions).
  • Tried it in the app (what you converted or clicked, and on which OS):

New EngineSetupReleaseTests (7 cases), passing 10 runs in a row:

  • Opened through WindowService.ShowEngineSetup() and closed with window.Close() or the Close command, three times each: every closed window and view model is collected and each package's setup handler count is back to where it started.
  • Created directly and closed with window.Close(), the Close command, or a real Esc key press: same checks.
  • Releasing twice keeps other view models' handlers; while the window is open, ticking a package still updates the selection text, the Install button and the close button text.

Each test fails when the fix is taken out: without the Closed release the window.Close() cases fail, without the unsubscribe all of them fail, releasing only in WindowService fails the directly created case, and releasing on open fails the open-window checks.

With the leak probe from the investigation, the 9 setup windows that stayed alive until the end of the run (RenderTests.First_run_engine_setup_renders in 7 languages, UiZoomTests.Engine_setup_grows_with_the_zoom_and_nothing_is_cut_off at 1.5 and 1.8) are now all collected by the next test.

Screenshots (UI changes)

None, the window looks the same.

Checklist

  • New UI strings are in all src/Filee.App/Assets/i18n/*.json files (no new strings)
  • New third-party code or binaries are listed in THIRD-PARTY-NOTICES.md (none)
  • The PR does one thing (unrelated changes go in a separate PR)

Closing the setup window with the title bar left its view model
subscribed to the shared engine packages, so the window and view
model were never collected. The window now releases those handlers
on Closed; the Close command keeps doing it too.
@SeoJCalive SeoJCalive changed the title 1. fix(app): release the engine setup window however it is closed (#666) fix(app): release the engine setup window however it is closed (#666) Oct 29, 2026
@SeoJCalive SeoJCalive added macos Run the macOS packages and tests in CI for this pull request bug Something isn't working labels Oct 29, 2026

@KnifeLemon KnifeLemon left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @SeoJCalive! Releasing on Closed covers the title-bar X, Alt+F4, the button and Esc, and putting it on the window keeps directly created windows covered too. Closes #666 as agreed there.

@KnifeLemon
KnifeLemon merged commit 9d83eaa into main Oct 29, 2026
19 checks passed
@SeoJCalive
SeoJCalive deleted the fix/666-engine-setup-release branch October 29, 2026 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working macos Run the macOS packages and tests in CI for this pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Some App tests leave closed windows alive after GC

2 participants