[PR #13882] Fix a ControlCore race condition on connection close #29801

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

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

State: closed
Merged: Yes


As noted by the winrt::event documentation:

[...] But for asynchronous events, even after revoking [...], an in-flight
event might reach your object after it has started destructing.

This is because while adding/removing/calling event handlers might be
thread-safe, there's no guarantee that they run mutually exclusive.

This commit fixes the issue by reverting 6f0f245. Since we never checked
the result of closing a terminal connection anyways, this commit simply drops
the wait on the connection being teared down to ensure #1996 doesn't regress.

Closes #13880

Validation Steps Performed

  • Open tab, close tab, open tab, close tab, open tab, close tab
    • ConPTY
    • Azure
  • Closing a tab with a huge amount of panes
  • Opening a bunch of tabs and then closing the window
  • Closing a tab while it's busy with VT
  • wtd -w 0 nt cmd /c exit
  • wtd -w -1 cmd /c exit
    • No WerFault spawns
**Original Pull Request:** https://github.com/microsoft/terminal/pull/13882 **State:** closed **Merged:** Yes --- As noted by the `winrt::event` documentation: > [...] But for asynchronous events, even after revoking [...], an in-flight > event might reach your object after it has started destructing. This is because while adding/removing/calling event handlers might be thread-safe, there's no guarantee that they run mutually exclusive. This commit fixes the issue by reverting 6f0f245. Since we never checked the result of closing a terminal connection anyways, this commit simply drops the wait on the connection being teared down to ensure #1996 doesn't regress. Closes #13880 ## Validation Steps Performed * Open tab, close tab, open tab, close tab, open tab, close tab * ConPTY ✅ * Azure ✅ * Closing a tab with a huge amount of panes ✅ * Opening a bunch of tabs and then closing the window ✅ * Closing a tab while it's busy with VT ✅ * `wtd -w 0 nt cmd /c exit` ✅ * `wtd -w -1 cmd /c exit` * No WerFault spawns ✅
claunia added the pull-request label 2026-01-31 09:36:58 +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#29801