[PR #18632] Fix a shutdown race condition in ControlCore #31576

Closed
opened 2026-01-31 09:48:08 +00:00 by claunia · 0 comments
Owner

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

State: closed
Merged: Yes


I found multiple issues while investigating this:

  • Render thread shutdown is racy, because it doesn't actually stop the render thread.
  • Lifetime management in ControlCore failed to account for the circular dependency of render thread --> renderer --> render data --> terminal --> renderer --> render thread. Fixed by reordering the ControlCore members to ensure their correct destruction.
  • Ensured that the connection setter calls close on the previous connection.

(Hopefully) Closes #18598

Validation Steps Performed

  • Can't repro the original failure
  • Opening and closing tabs as fast as possible doesn't crash anymore
  • Detaching and reattaching a tab producing continuous output
**Original Pull Request:** https://github.com/microsoft/terminal/pull/18632 **State:** closed **Merged:** Yes --- I found multiple issues while investigating this: * Render thread shutdown is racy, because it doesn't actually stop the render thread. * Lifetime management in `ControlCore` failed to account for the circular dependency of render thread --> renderer --> render data --> terminal --> renderer --> render thread. Fixed by reordering the `ControlCore` members to ensure their correct destruction. * Ensured that the connection setter calls close on the previous connection. (Hopefully) Closes #18598 ## Validation Steps Performed * Can't repro the original failure ❌ * Opening and closing tabs as fast as possible doesn't crash anymore ✅ * Detaching and reattaching a tab producing continuous output ✅
claunia added the pull-request label 2026-01-31 09:48:08 +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#31576