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

Unregister Window::SizeChanged event in TwoPaneView to prevent crashes with C++ apps #2045

Merged
merged 2 commits into from
Mar 4, 2020

Conversation

rudyhuyn
Copy link
Contributor

Description

TwoPaneView crashes with C++ apps if the page hosting the control isn't one currently displayed and if the window is resized (manually, change screen orientation, span/unspan the window, ...)

TwoPaneView registers to "Windows::SizeChanged" events and never unregisters them. After navigation, the instance of TwoPaneView from the first page is destroyed (destructor called), but the event is still registered which will crash the application when the system will try to call the callback method.

This PR simply unregisters Window::SizeChanged event in TwoPaneView's destructor to prevent crashes.

Motivation and Context

Fixes #2044

How Has This Been Tested?

Tested on Windows 10 Desktop and Windows 10X

@msft-github-bot msft-github-bot added the needs-triage Issue needs to be triaged by the area owners label Feb 29, 2020
@ranjeshj ranjeshj added area-TwoPaneView team-Controls Issue for the Controls team and removed needs-triage Issue needs to be triaged by the area owners labels Feb 29, 2020
@StephenLPeters
Copy link
Contributor

@rudyhuyn do you think you'll be able to address the feedback?

@StephenLPeters StephenLPeters added the needs-author-feedback Asked author to supply more information. label Mar 2, 2020
@ranjeshj
Copy link
Contributor

ranjeshj commented Mar 3, 2020

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ranjeshj ranjeshj removed the needs-author-feedback Asked author to supply more information. label Mar 4, 2020
@ranjeshj ranjeshj merged commit b3a2e45 into microsoft:master Mar 4, 2020
@rudyhuyn rudyhuyn deleted the Fix2044 branch March 13, 2020 07:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-TwoPaneView team-Controls Issue for the Controls team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TwoPaneView crashes after page navigation and window resizing in C++ apps
5 participants