-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[Windows] Close the WebView2 disconnecting the Handler #12925
Conversation
src/Controls/src/Core/WebView.cs
Outdated
#if WINDOWS | ||
else if (propertyName == nameof(Window) && Window is not null) | ||
Window.Destroying += OnWindowDestroying; | ||
#endif |
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.
This feels like the wrong place... or thing... no idea why just yet, but maybe I am feeling that some other event should go down the line when a window hosting a control is closed... Is there some Unloaded or some such event that gets to controls when a window is closed.
If I have a label in a window and close the window, do we have some event? Unloaded? The Window property goes null?
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.
Mnn, yeah. I think that to have something simpler, we need a way to be able to have window change notifications from Handlers.
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.
@jsuarezruiz @mattleibow can we get this agreed on so that we can land the PR?
|
||
namespace Microsoft.Maui.Controls | ||
{ | ||
public partial class WebView | ||
{ | ||
protected override void OnPropertyChanging(string? propertyName = null) |
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.
I think @PureWeen just added a WindowChanged event - and we may want to make that public. Maybe when a window is closing, we can propagate a Window = null change?
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.
Approving, some small comments, wait or @mattleibow to comment in the event question.
src/Controls/src/Core/WebView.cs
Outdated
#if WINDOWS | ||
else if (propertyName == nameof(Window) && Window is not null) | ||
Window.Destroying += OnWindowDestroying; | ||
#endif |
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.
@jsuarezruiz @mattleibow can we get this agreed on so that we can land the PR?
Closing this one as we merged another approach on the handler side #13206 |
Description of Change
Changes:
To test/validate the changes, open the .NET MAUI Gallery and navigate to the Core section. Select the MutiWindow demo and open a new Window. Then, close it. Without exceptions, the test passed. We are:
Issues Fixed
Fixes #10436
Fixes #8323
Fixes #7317
Fixes #12956