Skip to content

fix(win/app): close every window before Application.Exit so Quit exits - #6

Merged
LoganRupe merged 1 commit into
feature/ci/release-workflowfrom
fix/win-app/quit-hang
Oct 10, 2026
Merged

LoganRupe merged 1 commit into
feature/ci/release-workflowfrom
fix/win-app/quit-hang

Conversation

@LoganRupe

Copy link
Copy Markdown
Owner

What and why

Quit from the tray panel could leave the process running with the CursorFollow Output window still up. Fixes #5.

It happens once the Settings window has been opened. Application.Exit() then closed only some of the app's three windows and returned. The window it skipped (output in one run, Settings in another) kept the WinUI message loop going. Evidence from the hung process:

  • UI thread stack: idle in FrameworkApplication::RunDesktopWindowMessageLoop → GetMessageW, so nothing is blocked. The loop just never quits.
  • A temporary trace of each window's Closed event: panel and Settings closed, Exit() returned, and the output window never got a close.
  • Without Settings open (two windows), Exit closes everything and the process ends.

ExitApplication now closes Settings, the panel and the output window itself before calling Exit(). No forced Environment.Exit.

Not a regression from #4. The framework-dependent Debug build (dotnet build) hangs the same way.

Platforms

  • macOS: built and tested
  • Windows: built and tested
  • Linux: built and tested
  • Other platforms need the same change: no, Windows-only shutdown path

Windows testing was scripted (tray click → select target → Resume → optional Settings → Quit → confirm) with a capture running at ~30 fps:

Build Before After
Debug, Settings open hung (output window left) 3/3 exited in 0.13 s
Self-contained publish / MSI, Settings open hung (Settings window left) 3/3 exited in ≤0.15 s
MSI, Settings opened then cancelled not tested 3/3 exited in ≤0.13 s
Debug / MSI, no Settings exited 4/4 exited in ≤0.13 s

dotnet test tests/CursorFollowWin.Tests: 20/20 passed.

Checklist

  • CHANGELOG.md updated under Unreleased (if user-visible)
  • Signing, entitlements or identifiers changed? Called out above.

With the Settings window open, Application.Exit closed only some of the
three windows and returned. The window it skipped (the output window in
one run, Settings in another) never got a close, so the WinUI message
loop kept running and the process stayed alive. A trace of Closed events
showed Exit never touched the surviving window. ExitApplication now
closes Settings, the panel and the output window itself, then calls Exit.

Not a regression from the self-contained publish: the framework-dependent
Debug build hangs the same way.

Fixes #5
@LoganRupe
LoganRupe merged commit 5ecbc11 into feature/ci/release-workflow Oct 10, 2026
3 checks passed
@LoganRupe
LoganRupe deleted the fix/win-app/quit-hang branch October 10, 2026 09:53
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