[PR #10115] Fix a number of shutdown crashes in TermControl #27901

Open
opened 2026-01-31 09:25:00 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/10115

State: closed
Merged: Yes


  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

**Original Pull Request:** https://github.com/microsoft/terminal/pull/10115 **State:** closed **Merged:** Yes --- 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
claunia added the pull-request label 2026-01-31 09:25:00 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#27901