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

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

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

State: closed
Merged: Yes


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.

**Original Pull Request:** https://github.com/microsoft/terminal/pull/10033 **State:** closed **Merged:** Yes --- 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.
claunia added the pull-request label 2026-01-31 09:24: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#27865