Repository navigation
fix: never open a second main window from the tray - #492
Merged
Merged
Conversation
On Windows the tray icon raises Clicked straight from its window procedure, so a tray click handled while ShowMain was still building the window (before _main was set) built a second one; the first then became an orphan nothing tracked. A click that arrived while a window that went to the tray was being closed for good also re-showed that dying window instead of opening a new one. ShowMain now marks that it is building the window and sends calls made meanwhile to it (keeping the page they asked for), opens a new window when the tracked one is being released, and sends any other main window still alive to the tray. The release flag is cleared again if the close is cancelled. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
KnifeLemon
added a commit
to gtxPrime/Filee
that referenced
this pull request
Oct 23, 2026
Resolves WindowService.ShowMain against the single-main-window fix (KnifeLemon#492): the main window is now made in CreateMain, which applies the theme's window class (PrepareWindow) like the other windows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4 tasks done
2 tasks done
KnifeLemon
added a commit
to gtxPrime/Filee
that referenced
this pull request
Oct 23, 2026
The app has one WindowService, so tests that open, close or count the main window share it. Run in parallel, one test's pumping ran another's posted close or open, and OpenMain/CloseMain found a window that wasn't theirs (main CI failed after KnifeLemon#492 added the single-main-window tests). They now share a collection that doesn't run in parallel. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
Sometimes, after double-clicking the tray icon several times, two main windows were open at once.
Clickedsynchronously from its window procedure (WM_TRAYMOUSE→OnClicked, not posted).ShowMainonly set_mainafter building the view model, the window, the restored placement and the restored page. A tray click handled during that work re-enteredShowMain, saw_main == nulland built a second window. The outer call then overwrote_main, so the first window became an orphan that nothing tracked. After the first trip to the tray the build path is longer (placement and last page, e.g. Theme), which fits the bug showing up mid-session rather than on a fresh start.WindowService.ShowMain):ShowMainkeeps a list of every main window it built that isn't closed yet. Any other still alive goes to the tray (and is released), so there is never more than one main window.MainWindowexposesIsReleasedand clears_releasingagain if the release close is cancelled.Test plan
SingleMainWindowTests(headless). All three fail onmainand pass with the fix:HideToTray, pumped and unpumped, with clicks injected during build and release (3 seeds)MainWindowReleaseTests,CloseActionTests,TrayServiceTests,WhatsNewTests,ToolbarEditorTests,ThemePageTestspassdotnet format Filee.slnx --verify-no-changes, build🤖 Generated with Claude Code