[PR #10117] [MERGED] (1.9 port) Fix a number of shutdown crashes in TermControl #27909

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/10117
Author: @DHowett
Created: 5/17/2021
Status: Merged
Merged: 5/18/2021
Merged by: @DHowett

Base: mainHead: dev/duhowett/1.9-stab


📝 Commits (1)

  • e0d967d Fix a number of shutdown crashes in TermControl

📊 Changes

4 files changed (+54 additions, -16 deletions)

View changed files

📝 src/cascadia/TerminalControl/TSFInputControl.cpp (+3 -1)
📝 src/cascadia/TerminalControl/TermControl.cpp (+11 -1)
📝 src/cascadia/TerminalControl/TermControl.h (+2 -0)
📝 src/cascadia/TerminalControl/TermControlAutomationPeer.cpp (+38 -14)

📄 Description

  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 661fde5937)


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/10117 **Author:** [@DHowett](https://github.com/DHowett) **Created:** 5/17/2021 **Status:** ✅ Merged **Merged:** 5/18/2021 **Merged by:** [@DHowett](https://github.com/DHowett) **Base:** `main` ← **Head:** `dev/duhowett/1.9-stab` --- ### 📝 Commits (1) - [`e0d967d`](https://github.com/microsoft/terminal/commit/e0d967d1509e8221e6cea9061c0559361227230f) Fix a number of shutdown crashes in TermControl ### 📊 Changes **4 files changed** (+54 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalControl/TSFInputControl.cpp` (+3 -1) 📝 `src/cascadia/TerminalControl/TermControl.cpp` (+11 -1) 📝 `src/cascadia/TerminalControl/TermControl.h` (+2 -0) 📝 `src/cascadia/TerminalControl/TermControlAutomationPeer.cpp` (+38 -14) </details> ### 📄 Description 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 661fde59375b52e2c67b7c9483cc2358508484c2) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:25:05 +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#27909