[PR #13410] [MERGED] Fix a race condition in CTerminalHandoff::s_StopListening #29527

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/13410
Author: @lhecker
Created: 7/1/2022
Status: Merged
Merged: 7/5/2022
Merged by: @undefined

Base: mainHead: dev/lhecker/race-condition


📝 Commits (1)

  • 81d24dd Fix a race condition in CTerminalHandoff::s_StopListening

📊 Changes

2 files changed (+14 additions, -4 deletions)

View changed files

📝 src/cascadia/TerminalConnection/CTerminalHandoff.cpp (+11 -4)
📝 src/cascadia/TerminalConnection/CTerminalHandoff.h (+3 -0)

📄 Description

This commit fixes a minor race condition covered as part of #13368.
The member _pfnHandoff was read without the mutex _mtx being locked first.
The issue was solved by acquiring the lock early and running the entire
s_StopListening function with that lock held.


🔄 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/13410 **Author:** [@lhecker](https://github.com/lhecker) **Created:** 7/1/2022 **Status:** ✅ Merged **Merged:** 7/5/2022 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `dev/lhecker/race-condition` --- ### 📝 Commits (1) - [`81d24dd`](https://github.com/microsoft/terminal/commit/81d24dd2b08717510d419caf27f898574aa74dd8) Fix a race condition in CTerminalHandoff::s_StopListening ### 📊 Changes **2 files changed** (+14 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalConnection/CTerminalHandoff.cpp` (+11 -4) 📝 `src/cascadia/TerminalConnection/CTerminalHandoff.h` (+3 -0) </details> ### 📄 Description This commit fixes a minor race condition covered as part of #13368. The member `_pfnHandoff` was read without the mutex `_mtx` being locked first. The issue was solved by acquiring the lock early and running the entire `s_StopListening` function with that lock held. --- <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:35:27 +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#29527