-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
Fix a number of shutdown crashes in TermControl #10115
Conversation
1. The TSFInputControl may get a layout event after it has been removed from service (and no longer has a XAML tree) * Two fixes: * first, guard the layour updater from accessing detached xaml objects * second, shut down all pending throttled functions during close (not destruction!¹) 2. The TermControlAutomationPeer may be destructed before its events fire. 3. The TermControlAutomationPeer may receive a notification after it has been detached from XAML (and therefore has no dispatcher). ¹ Close happens before the control is removed from the XAML tree; destruction happens some time later. We must detach all UI-bound events in Close so that they don't fire between when we detach and when we destruct.
I will port this forward to 1.8, but I will need some assistance in porting it for 1.9. |
In general (/cc @zadjii-msft), we need to be very crisp on what constitutes "teardown" for UI objects and teardown for the control. All of these crashes are caused by the UI being in a torn down state, but the control itself not being a torn down state and trying to manipulate the UI. |
These account for 65% of all the WT Stable crashes in Watson (!) |
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.
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 don't quite understand how there cannot be a Dispatcher sometimes... I always assumed that it's valid until after the class was deallocated...
1. The TSFInputControl may get a layout event after it has been removed from service (and no longer has a XAML tree) * Two fixes: * first, guard the layour updater from accessing detached xaml objects * second, shut down all pending throttled functions during close (not destruction!¹) 2. The TermControlAutomationPeer may be destructed before its events fire. 3. The TermControlAutomationPeer may receive a notification after it has been detached from XAML (and therefore has no dispatcher). ¹ Close happens before the control is removed from the XAML tree; destruction happens some time later. We must detach all UI-bound events in Close so that they don't fire between when we detach and when we destruct. Fixes MSFT-32496693 Fixes MSFT-32496158 Fixes MSFT-32509759 Fixes MSFT-32871913 (cherry picked from commit 661fde5)
🎉 Handy links: |
🎉 Handy links: |
from service (and no longer has a XAML tree)
objects
(not destruction!¹)
fire.
been detached from XAML (and therefore has no dispatcher).
¹ Close happens before the control is removed from the XAML tree;
destruction happens some time later. We must detach all UI-bound events
in Close so that they don't fire between when we detach and when we
destruct.
Fixes MSFT-32496693
Fixes MSFT-32496158
Fixes MSFT-32509759
Fixes MSFT-32871913