Pin the detached window's close-reentry latch too - #492
Merged
Conversation
#488 gave DetachedWindowHelper the same walk-in-progress latch MainWindow.OnClosing got, for the same gap, but only the MainWindow half was pinned. Deleting the detached closeGuardPending check outright left the suite green — which is how a latch gets tidied away by someone who reasonably believes the tests are watching it. Same shape as the existing test, against the detached window: close once and the question comes up, close again and no second prompt stacks, dismiss it and the window stays with the latch cleared, close once more and a fresh question starts. Proved red against the latch's absence before it went green. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016a1AnKAHwcALrwdYVVrpgR
|
Reviewed. Test-only change, no production code touched — verified the latch it's pinning ( |
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.
#488 closed a reentrancy gap in two places —
MainWindow.OnClosingandDetachedWindowHelpereach latch while their unsaved-work question is still up, because_closeConfirmed/closeConfirmedonly latch after a yes and so do nothing about a second close arriving mid-walk.Only the MainWindow half was pinned. I deleted the detached
closeGuardPendingcheck outright and the suite stayed green:Two separate guards with separate state, one test. That is how a latch gets tidied away by someone who reasonably believes the tests are watching it.
This adds the twin, same shape as the existing one but against the detached window: close once and the question comes up, close again and no second prompt stacks, dismiss it and the window stays with the latch cleared, close once more and a fresh question starts. That last step matters as much as the others — a latch that never clears makes the X dead for the rest of the window's life.
Proved red first. With the latch removed:
Restored: 445 passed, 0 failed, 2 skipped.
Tests only — no production change.
🤖 Generated with Claude Code
https://claude.ai/code/session_016a1AnKAHwcALrwdYVVrpgR