[Windows] Close the WebView2 disconnecting the Handler#12925
[Windows] Close the WebView2 disconnecting the Handler#12925jsuarezruiz wants to merge 4 commits intomainfrom
Conversation
| #if WINDOWS | ||
| else if (propertyName == nameof(Window) && Window is not null) | ||
| Window.Destroying += OnWindowDestroying; | ||
| #endif |
There was a problem hiding this comment.
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.
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.
@jsuarezruiz @mattleibow can we get this agreed on so that we can land the PR?
| { | ||
| public partial class WebView | ||
| { | ||
| protected override void OnPropertyChanging(string? propertyName = null) |
There was a problem hiding this comment.
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?
mandel-macaque
left a comment
There was a problem hiding this comment.
Approving, some small comments, wait or @mattleibow to comment in the event question.
| #if WINDOWS | ||
| else if (propertyName == nameof(Window) && Window is not null) | ||
| Window.Destroying += OnWindowDestroying; | ||
| #endif |
There was a problem hiding this comment.
@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