[Audit] Remove suppression on CodepointWidthDetector #3759

Open
opened 2026-01-30 23:29:33 +00:00 by claunia · 1 comment
Owner

Originally created by @miniksa on GitHub (Sep 5, 2019).

While turning on the audit mode, I ran into a condundrum with the CodepointWidthDetector that I didn't really want to dig into at the moment.

The warning is complaining that we have a global object with complex initialization. That is true. But there's some decisions to be made here that equaled "not-a-quick-fix".

The CodepointWidthDetector is a class designed to have multiple instances if need be.

However, for the most part, it is used in a single-instance manner inside conhost and wt.

The class GlyphWidth.cpp is mostly a wrapper around CodepointWidthDetector to turn it into a singleton that can be accessed by C-style methods in the global namespace.

The decisions here are really around...

Should CodepointWidthDetector just be a singleton itself and only hand out a copy of itself on Instance()? I know that's fine for conhost, but I haven't fully considered it for wt yet.

If we get rid of the C-style global namespace methods (by removing the entire GlyphWidth class), will that cause a kerfluffle throughout the conhost codebase (and maybe wt too) because there are a bunch of places that gratuitously grab the global state since it was never encapsulated before?

Anything else I didn't have time to fully consider here?

Originally created by @miniksa on GitHub (Sep 5, 2019). While turning on the audit mode, I ran into a condundrum with the `CodepointWidthDetector` that I didn't really want to dig into at the moment. The warning is complaining that we have a global object with complex initialization. That is true. But there's some decisions to be made here that equaled "not-a-quick-fix". The `CodepointWidthDetector` is a class designed to have multiple instances if need be. However, for the most part, it is used in a single-instance manner inside `conhost` and `wt`. The class `GlyphWidth.cpp` is mostly a wrapper around `CodepointWidthDetector` to turn it into a singleton that can be accessed by C-style methods in the global namespace. The decisions here are really around... Should `CodepointWidthDetector` just be a singleton itself and only hand out a copy of itself on `Instance()`? I know that's fine for `conhost`, but I haven't fully considered it for `wt` yet. If we get rid of the C-style global namespace methods (by removing the entire `GlyphWidth` class), will that cause a kerfluffle throughout the `conhost` codebase (and maybe `wt` too) because there are a bunch of places that gratuitously grab the global state since it was never encapsulated before? Anything else I didn't have time to fully consider here?
Author
Owner

@0xabu commented on GitHub (Sep 20, 2019):

See also #2375 … still hitting this crash at least once per week.

@0xabu commented on GitHub (Sep 20, 2019): See also #2375 … still hitting this crash at least once per week.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#3759