Browse Source

Fonts: ClearOutputData() doesn't need to clear FallbackChar, EllipsisChar. Fixed crash changing font loader.

ocornut 1 week ago
parent
commit
a726bded11
2 changed files with 9 additions and 7 deletions
  1. 8 5
      docs/CHANGELOG.txt
  2. 1 2
      imgui_draw.cpp

+ 8 - 5
docs/CHANGELOG.txt

@@ -43,11 +43,14 @@ Breaking Changes:
 
 Other Changes:
 
-- Fonts: fixed handling of `ImFontConfig::FontDataOwnedByAtlas = false` which
-  did erroneously make a copy of the font data, essentially defeating the purpose
-  of this flag and wasting memory.
-  Undetected since July 2015 and now spotted by @TellowKrinkle, this is perhaps
-  the oldest bug in Dear ImGui history (albeit for a rarely used feature)! (#9086)
+- Fonts:
+  - Fixed handling of `ImFontConfig::FontDataOwnedByAtlas = false` which
+    did erroneously make a copy of the font data, essentially defeating the purpose
+    of this flag and wasting memory.
+    Undetected since July 2015 and now spotted by @TellowKrinkle, this is perhaps
+    the oldest bug in Dear ImGui history (albeit for a rarely used feature)! (#9086)
+  - Fixed an issue related to EllipsisChar handling, while changing
+    font loader or font loader flags dynamically in Style->Fonts menus.
 - Textures:
   - Fixed a building issue when ImTextureID is defined as a struct.
   - Fixed displaying texture # in Metrics/Debugger window.

+ 1 - 2
imgui_draw.cpp

@@ -3230,7 +3230,6 @@ void ImFontAtlasBuildNotifySetFont(ImFontAtlas* atlas, ImFont* old_font, ImFont*
 void ImFontAtlas::RemoveFont(ImFont* font)
 {
     IM_ASSERT(!Locked && "Cannot modify a locked ImFontAtlas!");
-    font->ClearOutputData();
 
     ImFontAtlasFontDestroyOutput(this, font);
     for (ImFontConfig* src : font->Sources)
@@ -5106,7 +5105,7 @@ void ImFont::ClearOutputData()
 {
     if (ImFontAtlas* atlas = OwnerAtlas)
         ImFontAtlasFontDiscardBakes(atlas, this, 0);
-    FallbackChar = EllipsisChar = 0;
+    //FallbackChar = EllipsisChar = 0;
     memset(Used8kPagesMap, 0, sizeof(Used8kPagesMap));
     LastBaked = NULL;
 }