[PR #10033] [MERGED] Backport hotfix ac265aa to v1.8 #27860

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/10033
Author: @lhecker
Created: 5/4/2021
Status: Merged
Merged: 5/4/2021
Merged by: @DHowett

Base: release-1.8Head: dev/lhecker/fix-exit-crash-1.8


📝 Commits (1)

📊 Changes

1 file changed (+23 additions, -24 deletions)

View changed files

📝 src/cascadia/TerminalControl/TermControl.cpp (+23 -24)

📄 Description

This backports ac265aab99 to v1.8.

ControlCore's _renderer (IRenderTarget) is allocated as std::unique_ptr,
but is given to Terminal::CreateFromSettings as a reference.
ControlCore::Close deallocates the _renderer, but if ThrottledFuncs
are still scheduled to call ControlCore::UpdatePatternLocations
it'll cause Terminal::UpdatePatterns to be called, which in turn ends up
accessing the deallocated IRenderTarget reference and lead to a crash.

A proper solution with shared pointers is nontrivial and should be
attempted at a later point in time. This solution moves the teardown of
the _renderer into ControlCore::~ControlCore, where we can be certain
that no further strong references are held by ThrottledFuncs.


🔄 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/10033 **Author:** [@lhecker](https://github.com/lhecker) **Created:** 5/4/2021 **Status:** ✅ Merged **Merged:** 5/4/2021 **Merged by:** [@DHowett](https://github.com/DHowett) **Base:** `release-1.8` ← **Head:** `dev/lhecker/fix-exit-crash-1.8` --- ### 📝 Commits (1) - [`c61a580`](https://github.com/microsoft/terminal/commit/c61a580f14a584a750d18b7ca2e1d5bf11004f6d) Backport hotfix ac265aa to v1.8 ### 📊 Changes **1 file changed** (+23 additions, -24 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalControl/TermControl.cpp` (+23 -24) </details> ### 📄 Description This backports ac265aab99d5f79345074fbff66c54a816120de1 to v1.8. ControlCore's _renderer (IRenderTarget) is allocated as std::unique_ptr, but is given to Terminal::CreateFromSettings as a reference. ControlCore::Close deallocates the _renderer, but if ThrottledFuncs are still scheduled to call ControlCore::UpdatePatternLocations it'll cause Terminal::UpdatePatterns to be called, which in turn ends up accessing the deallocated IRenderTarget reference and lead to a crash. A proper solution with shared pointers is nontrivial and should be attempted at a later point in time. This solution moves the teardown of the _renderer into ControlCore::~ControlCore, where we can be certain that no further strong references are held by ThrottledFuncs. --- <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:24:44 +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#27860