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

Move the subscription to LocationChanged and Deactivated Window events to OnLoaded. #62

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

KristinaKoeva
Copy link

When you have one single WPF Window and its Content is a WebView, you could simulate reloading of the WebView, by disposing the old one and creating a new one. This causes the
OnVisualParentChanged to execute two times, for the old and new WebView. The Window is the same so the following code,
window->LocationChanged += _handler; window->Deactivated += _handler;
executes two times. When the location of the Window changes the handler for the old, disposed view is invoked, which is incorrect and causes exceptions.

@KristinaKoeva
Copy link
Author

Hey,

Unfortunately there are still few cases when Window::GetWindow(oldParent) returns null. The last commit stores the window reference, so that we could use it to unsubscribe from the events.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant