[PR #5654] Grab the write lock before updating the font #26412

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

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

State: closed
Merged: Yes


Summary of the Pull Request

Based on the discussion in #5479, it seems that the crash is caused by a race condition due to not obtaining the write lock before calling TriggerFontChange.

I'm not totally sure if my approach is the right one, but I've taken the lock out of _RefreshSize since it seems like all calls of _RefreshSize come after a TriggerFontChange/UpdateFont. Then I just
made sure all calls of TriggerFontChange/UpdateFont are preceded with a LockForWriting.

PR Checklist

Validation Steps Performed

Scrolling to change my font size does not kill the Terminal anymore! 🙌

**Original Pull Request:** https://github.com/microsoft/terminal/pull/5654 **State:** closed **Merged:** Yes --- ## Summary of the Pull Request Based on the discussion in #5479, it seems that the crash is caused by a race condition due to not obtaining the write lock before calling `TriggerFontChange`. I'm not totally sure if my approach is the right one, but I've taken the lock out of `_RefreshSize` since it seems like all calls of `_RefreshSize` come after a `TriggerFontChange`/`UpdateFont`. Then I just made sure all calls of `TriggerFontChange`/`UpdateFont` are preceded with a `LockForWriting`. ## PR Checklist * [x] Closes #5479 * [x] CLA signed. * [x] Tests added/passed ## Validation Steps Performed Scrolling to change my font size does not kill the Terminal anymore! 🙌
claunia added the pull-request label 2026-01-31 09:15:54 +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#26412