Repository navigation
Conversation
Persist the current session synchronously for WM_QUERYENDSESSION without cancelling it. Bypass close-to-tray interception during the Windows session-ending path, preserving the normal application quit behavior on other platforms.
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.
Closes #58.
On Windows, Avalonia raises
ShutdownRequestedforWM_QUERYENDSESSION. Cancelling that event aborts sign-out or shutdown. The main window also intercepts non-programmatic closes for the close-to-tray feature, so both paths need to allow the Windows request through.This change saves the current session and settings synchronously, then lets Avalonia handle the Windows session end without cancelling it. It also bypasses close-to-tray interception for that request. A failed save is best-effort and won't block sign-out.
Normal application Exit still sends stopped announces and performs the existing timed cleanup. The non-Windows shutdown handler is unchanged.
Verification: Code reviewed against Avalonia 12.1.4's Windows platform and desktop lifetime implementations. The .NET SDK isn't available in this environment, so I haven't run the build or a Windows sign-out test. The PR needs CI plus a manual Windows shutdown/sign-out check (ideally with close-to-tray enabled), followed by a normal File > Exit check.
Changed:
App.axaml.cs,MainWindow.axaml.cs, andMainWindowViewModel.cs.