Skip to content
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

Fix - Complete window dialog task when dialog is hidden #18047

Merged
merged 3 commits into from
Feb 5, 2025

Conversation

emmauss
Copy link
Contributor

@emmauss emmauss commented Jan 24, 2025

What does the pull request do?

  • When a dialog window is hidden, sets the task returned with ShowDialog as complete.
  • Fixes an issue where the parent window would be moved down the z-order when a dialog window was hidden

What is the current behavior?

When a dialog window is shown, a task is return for user to wait on. This task is set to completed on Close, but not on Hide, even though the owner is set to null when hidden. This makes any thread waiting on the window to lock up.

What is the updated/expected behavior with this PR?

How was the solution implemented (if it's not obvious)?

Checklist

Breaking changes

Obsoletions / Deprecations

Fixed issues

@emmauss emmauss requested a review from grokys January 24, 2025 14:52
@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.3.999-cibuild0054544-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@kekekeks
Copy link
Member

Don't we also need to update "this window has child modal dialogs" state for dialog parent?

@kekekeks
Copy link
Member

Nvm, Owner is already set to null in Hide.

@MrJul MrJul added the bug label Jan 28, 2025
@MrJul
Copy link
Member

MrJul commented Feb 1, 2025

@emmauss the fix looks good but a matching unit test should probably be added.

Note: we already have a test WindowTests.IsVisible_Should_Close_DialogWindow.
Maybe the implementation could simply be changed so that Hide() calls Close() if the dialog is modal, which is what happens when IsVisible is set to false?

@emmauss
Copy link
Contributor Author

emmauss commented Feb 3, 2025

WindowTests.IsVisible_Should_Close_DialogWindow

Made Hide and IsVisible=false behave the same for all window types, i.e. they hide the window and not close it. Also updated tests.

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.3.999-cibuild0054737-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.3.999-cibuild0054741-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@emmauss emmauss force-pushed the complete_dialog_on_hide branch from 6156501 to 7a0a7bd Compare February 4, 2025 08:56
@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.3.999-cibuild0054753-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

Copy link
Member

@MrJul MrJul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@MrJul MrJul added this pull request to the merge queue Feb 5, 2025
Merged via the queue into master with commit 4c1edc2 Feb 5, 2025
11 checks passed
@MrJul MrJul deleted the complete_dialog_on_hide branch February 5, 2025 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants