[PR #9729] [MERGED] Resolve circular reference in ThrottledFunc #27711

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/9729
Author: @lhecker
Created: 4/6/2021
Status: Merged
Merged: 4/6/2021
Merged by: @undefined

Base: mainHead: dev/lhecker/issue-7710-throttled-func


📝 Commits (1)

  • 821aac6 Resolve circular reference in ThrottledFunc

📊 Changes

3 files changed (+55 additions, -79 deletions)

View changed files

📝 src/cascadia/TerminalControl/TerminalControlLib.vcxproj (+0 -1)
src/cascadia/TerminalControl/ThrottledFunc.cpp (+0 -54)
📝 src/cascadia/TerminalControl/ThrottledFunc.h (+55 -24)

📄 Description

Summary of the Pull Request

ThrottledFunc previously created a DispatcherTimer whose Tick callback holds a strong reference to the DispatcherTimer itself.
This causes a reference cycle, inadvertently leaking timer instances.

PR Checklist

Detailed Description of the Pull Request / Additional comments

I've initially wanted to remove the ThrottledFunc<> optimization, but it turns out that this causes a 3% slowdown. That's definitely not a lot, but enough that we can just keep the optimization for the time being.
I've moved the implementation from the .cpp file into the header regardless since the two implementations are extremely similar and it's easier that way to keep them in line.

Validation Steps Performed

I've ensured that the scrollbar still updates its length when I add new lines to a newly created tab.


🔄 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/9729 **Author:** [@lhecker](https://github.com/lhecker) **Created:** 4/6/2021 **Status:** ✅ Merged **Merged:** 4/6/2021 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `dev/lhecker/issue-7710-throttled-func` --- ### 📝 Commits (1) - [`821aac6`](https://github.com/microsoft/terminal/commit/821aac6dca0dc9534e10373df41f32fead8e1e44) Resolve circular reference in ThrottledFunc ### 📊 Changes **3 files changed** (+55 additions, -79 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalControl/TerminalControlLib.vcxproj` (+0 -1) ➖ `src/cascadia/TerminalControl/ThrottledFunc.cpp` (+0 -54) 📝 `src/cascadia/TerminalControl/ThrottledFunc.h` (+55 -24) </details> ### 📄 Description ## Summary of the Pull Request ThrottledFunc previously created a DispatcherTimer whose Tick callback holds a strong reference to the DispatcherTimer itself. This causes a reference cycle, inadvertently leaking timer instances. ## PR Checklist * [x] Closes #7710 * [x] I work here ## Detailed Description of the Pull Request / Additional comments I've initially wanted to remove the `ThrottledFunc<>` optimization, but it turns out that this causes a 3% slowdown. That's definitely not a lot, but enough that we can just keep the optimization for the time being. I've moved the implementation from the .cpp file into the header regardless since the two implementations are extremely similar and it's easier that way to keep them in line. ## Validation Steps Performed I've ensured that the scrollbar still updates its length when I add new lines to a newly created tab. --- <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:23:45 +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#27711