Repository navigation
fix(macos): close a window that closes itself while it is key - #2767
Merged
Merged
Conversation
|
The |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
oneo-me
force-pushed
the
agiox/fix-issue-2746
branch
from
November 29, 2026 15:44
a25944e to
477ef28
Compare
oneo-me
marked this pull request as ready for review
November 29, 2026 15:44
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
Fixes #2746. On macOS,
desktop.CloseWindowcalled from inside a key window, such as from anOnKey("escape", ...)handler, ranOnClosingand disposed the window's tree but left itsNSWindowon screen for good.performClose:runs inside the batch that carriesWindowClose, and on a key window it spins a run loop. That run loop delivered the wakeupMountposted for the batch destroying the window, andapplyBatches, already applying, returned without taking it. Asqueue.Batcheswakes the main thread once per drain, nothing woke it again: theWindowDestroybatch, and every later one, stayed queued.applyBatchesnow records a wakeup that arrives while it applies and takes what was queued before it returns. Windows and Linux had the same drop in theirapplyBatches(a modal loop or a GTK allocation while applying), so they now drain again too.I left
performClose:synchronous rather than deferring it withapple.OnMainas the issue also suggested: with the drain fixed, the destroy batch applies right afterperformClose:returns. Deferring it closed windows one turn later, which left a test's window on screen into the next test and madeTestMenuAutoEditingKeyandTestBackdropColorFiltersChangeWhatIsBehindflaky.Targets
core,base,ui,tsx, thensgotool)Screenshots
None
Verification
477ef28c20d7193bb92cda78b8c508e384c4a4021d16f441dd4e6642376fd33fead4d8898e0e7305go tool nsgo check→ 0go tool nsgo check -target linux,windows -jobs 4→ 0go tool nsgo test→ 1failTestQuickLookThumbnailDrawsTheAppOffTheScreen(1 surface left open), fails the same way on the base commit in a full run, and passes wheninternal/platform/macosruns on its own. The newTestApply*tests also pass on a Windows 11 desktop session and on Linux (Wayland). In both places the rest of each backend's native package fails identically with and without this change, so the device is to blame. No automated test makes a window key, which this bug needs, so the key-window path itself was not run end to end.Checklist
fix(linux): keep the caret after a paste; a squash merge uses it as the commit subject.changelog.d/fragment, not inCHANGELOG.md.🤖 Generated with Claude Code
🤖 Claude Opus 5.5