[PR #17221] PowerShell menu completion parser thread-safety fix #31162

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

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

State: closed
Merged: Yes


Fix Terminal crashing when experimental PowerShell menu completion is very quickly invoked multiple times.

Command::ParsePowerShellMenuComplete can be called from multiple threads, but it uses a static Json::CharReader, which cannot safely parse data from multiple threads at the same time. Removing static fixes the problem, since every function call gets its own reader.

Validation: Pressed Ctrl+Space quickly a few times with hardcoded huge JSON as the completion payload. Also shown at the end of the second video in #17220.

Closes #17220

**Original Pull Request:** https://github.com/microsoft/terminal/pull/17221 **State:** closed **Merged:** Yes --- Fix Terminal crashing when experimental PowerShell menu completion is very quickly invoked multiple times. `Command::ParsePowerShellMenuComplete` can be called from multiple threads, but it uses a `static` `Json::CharReader`, which cannot safely parse data from multiple threads at the same time. Removing `static` fixes the problem, since every function call gets its own `reader`. Validation: Pressed Ctrl+Space quickly a few times with hardcoded huge JSON as the completion payload. Also shown at the end of the second video in #17220. Closes #17220
claunia added the pull-request label 2026-01-31 09:45:30 +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#31162