[PR #14694] Add mutex to keyEvents in TermControlAutomationPeer #30213

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

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

State: closed
Merged: Yes


Some investigation revealed that _keyEvents would get a NULL_POINTER_READ error. On the main thread, RecordKeyEvent() would be called, which mainly updates _keyEvents. On the renderer thread, NotifyNewOutput() would be called, which starts by iterating through _keyEvents and slowly clearing it out. On occasion, these two threads are modifying _keyEvents simultaneously, causing a crash.

The fix is to add a mutex on this variable.

Closes #14592

**Original Pull Request:** https://github.com/microsoft/terminal/pull/14694 **State:** closed **Merged:** Yes --- Some investigation revealed that `_keyEvents` would get a `NULL_POINTER_READ` error. On the main thread, `RecordKeyEvent()` would be called, which mainly updates `_keyEvents`. On the renderer thread, `NotifyNewOutput()` would be called, which starts by iterating through `_keyEvents` and slowly clearing it out. On occasion, these two threads are modifying `_keyEvents` simultaneously, causing a crash. The fix is to add a mutex on this variable. Closes #14592
claunia added the pull-request label 2026-01-31 09:39:22 +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#30213