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

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/5654
Author: @leonMSFT
Created: 4/29/2020
Status: Merged
Merged: 4/30/2020
Merged by: @undefined

Base: masterHead: dev/lelian/scrollfontsizeded


📝 Commits (3)

  • b1eea0f take the lock out of RefreshSize, put it in its callers since they all seem to TriggerFontChange
  • 815716b small comment update
  • ae818c0 rename

📊 Changes

2 files changed (+19 additions, -13 deletions)

View changed files

📝 src/cascadia/TerminalControl/TermControl.cpp (+17 -11)
📝 src/cascadia/TerminalControl/TermControl.h (+2 -2)

📄 Description

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! 🙌


🔄 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/5654 **Author:** [@leonMSFT](https://github.com/leonMSFT) **Created:** 4/29/2020 **Status:** ✅ Merged **Merged:** 4/30/2020 **Merged by:** [@undefined](undefined) **Base:** `master` ← **Head:** `dev/lelian/scrollfontsizeded` --- ### 📝 Commits (3) - [`b1eea0f`](https://github.com/microsoft/terminal/commit/b1eea0f1dcadecf7fd738600a5c9daea8072dd37) take the lock out of RefreshSize, put it in its callers since they all seem to TriggerFontChange - [`815716b`](https://github.com/microsoft/terminal/commit/815716b02c4c67c04724c4353d9b34db01a47f0b) small comment update - [`ae818c0`](https://github.com/microsoft/terminal/commit/ae818c0dbaa728b499075a9335ec40ac0877b482) rename ### 📊 Changes **2 files changed** (+19 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalControl/TermControl.cpp` (+17 -11) 📝 `src/cascadia/TerminalControl/TermControl.h` (+2 -2) </details> ### 📄 Description ## 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! 🙌 --- <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:15:53 +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#26407