[PR #13015] Fix resize crash in OpenConsole with AtlasEngine #29335

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

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

State: closed
Merged: Yes


_api.cellCount caches the TextBuffer size in AtlasEngine.
Calculating it based on the _api.sizeInPixel is incorrect as the
TextBuffer size doesn't necessarily have to be the size of the window.
This can occur when the window is resized, as the main thread is receiving its
WM_SIZE message and resizing the TextBuffer concurrently with the render
thread performing a render pass and AtlasEngine checking the GetClientRect.

In order to inform AtlasEngine about the initial buffer size, Renderer
was modified to also invoke UpdateViewport() on the first render cycle.

The only other user of UpdateViewport() is VtEngine which used to call
InvalidateAll() in these situations. In order to prevent the InvalidateAll()
call, VtEngine::UpdateViewport() was modified to suppress this.

Validation Steps Performed

  • Resizing wide characters doesn't crash the terminal anymore
  • The additional call to UpdateViewport() doesn't break VtEngine
**Original Pull Request:** https://github.com/microsoft/terminal/pull/13015 **State:** closed **Merged:** Yes --- `_api.cellCount` caches the `TextBuffer` size in AtlasEngine. Calculating it based on the `_api.sizeInPixel` is incorrect as the `TextBuffer` size doesn't necessarily have to be the size of the window. This can occur when the window is resized, as the main thread is receiving its `WM_SIZE` message and resizing the `TextBuffer` concurrently with the render thread performing a render pass and AtlasEngine checking the `GetClientRect`. In order to inform `AtlasEngine` about the initial buffer size, `Renderer` was modified to also invoke `UpdateViewport()` on the first render cycle. The only other user of `UpdateViewport()` is `VtEngine` which used to call `InvalidateAll()` in these situations. In order to prevent the `InvalidateAll()` call, `VtEngine::UpdateViewport()` was modified to suppress this. ## Validation Steps Performed * Resizing wide characters doesn't crash the terminal anymore ✅ * The additional call to `UpdateViewport()` doesn't break VtEngine ✅
claunia added the pull-request label 2026-01-31 09:34:18 +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#29335