Guard island input site fallback during shutdown - #11063
Guard island input site fallback during shutdown#11063Jon Wiswall (jonwis) wants to merge 1 commit into
Conversation
|
Jon Wiswall (@jonwis) hey, any plan to pick this back up? I hit the same crash and had a repro built before I found your PR. Just re-tested on the latest bits: still reproduces on 1.7, 1.8 and 2.4.0, and that unguarded Would you rather rebase this one and get it merged, or should I open an issue and a new PR with the same fix? Happy either way, just don't want to duplicate your work. |
If you have time Essam (@TheBlueSky) please feel free to make a new issue/PR to move this to completion. |
CDependencyObject::GetElementIslandInputSite() called CCoreServices::GetInputServices()->GetPrimaryRegisteredIslandInputSite() without checking the result of GetInputServices(). By the time a focused TextBox is torn down during framework shutdown the input services are already gone, so the call runs on a null "this" and faults while reading m_islandInputSiteRegistrations. Null-check core services and input services and return nullptr instead. Every caller already funnels the result through CInputServices::GetUnderlyingInputHwndFromIslandInputSite(), which is declared _In_opt_ and null-checks its argument, so "no island input site" is already an expected result. Carries forward the fix proposed by @jonwis in microsoft#11063, rebased onto the current dxaml/ layout.
|
Jon Wiswall (@jonwis) Opened #11653 with the repro and the version details, and #11654 carries your fix rebased onto the current Thanks for the original diagnosis — the null |
|
Essam (@TheBlueSky) Please check whether the commit, 691c6a7 fixes your issue |
Fixes a crash during shutdown when the input island site has already been destroyed, avoid calling through a
nullptr.PR Type
Please check the type of change your PR introduces:
Description
A consistent crash on my machine in the "Tempo of UWP" app from MikeHillberg happens during process shutdown (hitting alt-f4.)
In frame 2, the input services object returned was null, causing frames 1 & 0 to operate on a null
thisand crash.Current Behavior
Currently, apps crash when shutting down in this way.
New Behavior
No longer crashes.
Motivation and Context
Crashing isn't fun. Less crashes is better.
How Has This Been Tested?