-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Fix dialogs not working across multiple windows #18636
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
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
// If two sources call ShowDialog() simultaneously, it may happen that both enter the above loop, | ||
// but it's crucial that only one of them continues below as only 1 dialog can be shown at a time. | ||
// Thankfully, everything runs on the UI thread, so only 1 caller will exit the above loop at a time. | ||
// So, if s_activeDialog is still set at this point, we must've lost the race. |
Check failure
Code scanning / check-spelling
Unrecognized Spelling
[must've](#security-tab) is not a recognized word. \(unrecognized-spelling\)
carlos-zamora
approved these changes
Feb 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this! And good find with the XAML Github issue 😊
DHowett
approved these changes
Feb 28, 2025
DHowett
pushed a commit
that referenced
this pull request
Mar 12, 2025
This can be considered "part 1" of fixing #18599: It prevents crashes (due to unhandled exceptions) by ensuring we only create 1 content dialog across all windows at a time. Sounds bad, but I tried it and it's not actually _that_ bad in practice (it's still really gross though). The bad news is that I don't have a "part 2", because I can't figure out what's going on: * Create 2 windows * Open the About dialog in window 1 and right click the text * Close the About dialog * Open the About dialog in window 2 and right click the text * WinUI will simply toss the focus to window 1 It appears as if context menus are permanently associated with the first window that uses them. It has nothing to do with whether a ContentDialog instance is reused (I tested that). ## Validation Steps Performed * Open 2 windows with 2 tabs each * Attempt to close window 1, dialog appears ✅ * Attempt to close window 2, dialog moves to window 2 ✅ (cherry picked from commit 3760cae) Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgXyCU0 Service-Version: 1.23
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Area-Windowing
Window frame, quake mode, tearout
Issue-Bug
It either shouldn't be doing this or needs an investigation.
Priority-1
A description (P1)
Product-Terminal
The new Windows Terminal.
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.
This can be considered "part 1" of fixing #18599: It prevents crashes (due to unhandled exceptions) by ensuring we only create 1 content dialog across all windows at a time. Sounds bad, but I tried it and it's not actually that bad in practice (it's still really gross though).
The bad news is that I don't have a "part 2", because I can't figure out what's going on:
and right click the text
and right click the text
It appears as if context menus are permanently associated with the first window that uses them. It has nothing to do with whether a ContentDialog instance is reused (I tested that).
Validation Steps Performed