소스 검색

Fonts: amend UpdateCurentFontSize() early out optimization.

ocornut 2 달 전
부모
커밋
0e769c5418
1개의 변경된 파일8개의 추가작업 그리고 1개의 파일을 삭제
  1. 8 1
      imgui.cpp

+ 8 - 1
imgui.cpp

@@ -8739,8 +8739,15 @@ void ImGui::UpdateCurrentFontSize(float restore_font_size_after_scaling)
     ImGuiWindow* window = g.CurrentWindow;
     ImGuiWindow* window = g.CurrentWindow;
 
 
     g.Style.FontSizeBase = g.FontSizeBase;
     g.Style.FontSizeBase = g.FontSizeBase;
+
+    // Early out to avoid hidden window keeping bakes referenced and out of GC reach.
+    // However this would leave a pretty subtle and damning error surface area if g.FontBaked was mismatching, so for now we null it.
     if (window != NULL && window->SkipItems)
     if (window != NULL && window->SkipItems)
-        return;
+        if (g.CurrentTable == NULL || g.CurrentTable->CurrentColumn != -1) // See 8465#issuecomment-2951509561. Ideally the SkipItems=true in tables would be amended with extra data.
+        {
+            g.FontBaked = NULL;
+            return;
+        }
 
 
     // Restoring is pretty much only used by PopFont()/PopFontSize()
     // Restoring is pretty much only used by PopFont()/PopFontSize()
     float final_size = (restore_font_size_after_scaling > 0.0f) ? restore_font_size_after_scaling : 0.0f;
     float final_size = (restore_font_size_after_scaling > 0.0f) ? restore_font_size_after_scaling : 0.0f;