Repository navigation
fix(macos): Close the windows through AppWindow.Closing when the app is asked to quit (backport #26063 to 6.7) - #26097
Merged
agneszitte merged 9 commits intoNov 6, 2026
Conversation
1 of 3 tasks
Contributor
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
Contributor
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-26097/docs/index.html |
nickrandolph
approved these changes
Nov 6, 2026
Contributor
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |
nickrandolph
enabled auto-merge
November 6, 2026 12:58
agneszitte
disabled auto-merge
November 6, 2026 14:24
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.
GitHub Issue: related to #26075, which #26063 closes on
masterPR Type:
🐞 Bugfix
What changed? 🚀
Manual
release/stable/6.7backport of #26063, synced to its headbb777cabc6. It carries the same commits as theservicing/6.8backport, #26064, and is synced again if #26063 changes.What it fixes (same as the
masterPR): on macOS, Cmd+Q, the application menu's Quit and the Dock's Quit end the app without raisingAppWindow.ClosingorWindow.Closed. Now:AppWindow.Closingfirst, which can cancel the quit, thenClosed. If one window cancels, the windows asked before it are closed; it and the windows behind it stay open.DispatcherShutdownModeis.OnExplicitShutdownstill keeps the app running after the user closes its last window, and a later Quit still ends it.ClosingorClosed, as before and as on Windows.Application.Exit()now matches WinUI'sFrameworkApplication::ExitImpl: it closes every window asWindow.Close()does, raisingWindow.Closedbut notAppWindow.Closing, then exits. AClosedhandler that setsHandledkeeps its window open, and withOnLastWindowClosethat keeps the app running.Closinghandler that throws logs an Error; a cancelled close andOnExplicitShutdownkeeping the app running log at Debug.doc/articles/features/app-close-handler.mdgains a macOS section, and the manual sampleWindowing/AppWindow_QuitClosesWindowscovers the scenarios.The behaviour changes and the manual test steps are in #26063.
Why not a Mergify backport: files moved for 7.0. On 6.7 the macOS host is
Uno.UI.Runtime.Skia.MacOS(notUno.UI.Runtime.MacOS), and the sample folder isMicrosoft_UI_Windowing(notMicrosoft/UI/Windowing), as on 6.8. The six files the fix touches are identical onrelease/stable/6.7andservicing/6.8, so the commits are #26064's, cherry-picked unchanged; the net diff is line for line the same as #26064's andmaster's.Same 6.8 difference, harmless here too: a closed window leaves the
windowsset only when it is deallocated, not when it closes. It is no longer visible, so a quit does not ask it.Validated on this branch (macOS 27, Apple silicon):
SamplesApp.Skia.Genericbuilds in Release, includinglibUnoNativeMac(withMACOSX_DEPLOYMENT_TARGET=12.0, since Xcode 27 refuses the project's 10.15 target). The library exportsuno_windows_close_for_quit. The sampleWindowing/AppWindow_QuitClosesWindowswas run, and quits were sent as the Dock's quit request:AppWindow.Closing→Window.Closed→ exits (0)kAEReallyLogOut)Closing, noClosedThe other behaviours (cancel, front-to-back order, hidden windows, file picker, throwing handler,
OnExplicitShutdown,Exit()parity) were checked onmasterwith SamplesApp; see #26063. The 6.8 backport, which has the same code, was also validated with Studio Live, the downstream app that needs this; see #26064.PR Checklist ✅