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 (!) |
lhecker
left a comment
There was a problem hiding this comment.
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