[PR #16324] Fix font preview for conhost #30895

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

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

State: closed
Merged: Yes


After exiting the main loop in this function the invariant
nFont <= NumberOfFonts still holds true. Additionally,
preceding this removed code is this (paraphrased):

if (nFont < NumberOfFonts) {
    RtlMoveMemory(...);
}

It ensures that the given slot nFont is always unoccupied by moving
it and all following items upwards if needed. As such, the call to
DeleteObject is always incorrect, as the slot is always "empty",
but may contain a copy of the previous occupant due to the memmove.

This regressed in 154ac2b.

Closes #16297

Validation Steps Performed

  • All fonts have a unique look in the preview panel
**Original Pull Request:** https://github.com/microsoft/terminal/pull/16324 **State:** closed **Merged:** Yes --- After exiting the main loop in this function the invariant `nFont <= NumberOfFonts` still holds true. Additionally, preceding this removed code is this (paraphrased): ```cpp if (nFont < NumberOfFonts) { RtlMoveMemory(...); } ``` It ensures that the given slot `nFont` is always unoccupied by moving it and all following items upwards if needed. As such, the call to `DeleteObject` is always incorrect, as the slot is always "empty", but may contain a copy of the previous occupant due to the `memmove`. This regressed in 154ac2b. Closes #16297 ## Validation Steps Performed * All fonts have a unique look in the preview panel ✅
claunia added the pull-request label 2026-01-31 09:43:39 +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#30895