microsoft / microsoft/terminal

Code Cleanup - Member variables not initialized in GdiEngine's constructor

Open
#887 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area-Build Issue-Bug Product-Conhost
Dominant language
C++
Stars
105k
Forks
9.6k
Avg merge
3d 17h
Merged PRs (30d)
29

Description

Minor Code cleanup

In src/renderer/gdi/state.cpp
GdiEngine's constructor is not initializing all of it's member variables.

_isTrueTypeFont
_fontCodepage
_tmFontMetrics
_coordFontLast
_psInvalidData

In Debug only
_debugWindow
_debugContext

As far as I can tell, none of the above variables are used before being initialized (in the normal code path). Most of these get set in UpdateFont and _CreateDebugWindow. It might make sense to make a pass and initialize these in the header with default values. Some members are correctly being set to a default value in the constructor, but it might be better for maintainability to remove those and initialize them in the header also.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/renderer/gdi/state.cpp and inspect GdiEngine's constructor alongside its class header. Check the listed normal and debug-only members, compare them with members already given defaults, and confirm that all intended members are initialized consistently without changing their later use in UpdateFont or _CreateDebugWindow.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
desktop
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.