From 22fe9fce4cd6d6ba5d484d0936218a98948812c5 Mon Sep 17 00:00:00 2001 From: Christian Fillion Date: Mon, 4 Aug 2025 00:57:44 -0400 Subject: [PATCH] Textures: fixed assertion in DebugNodeTexture() when ImTextureID_Invalid is non-zero. (#8860, #8745) ImFontAtlas's constructor resets ImTextureRef::_TexID to 0 instead of ImTextureID_Invalid. Amend bc051dc --- docs/CHANGELOG.txt | 2 ++ imgui_draw.cpp | 1 + 2 files changed, 3 insertions(+) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 89e8b34eb..8119ffd16 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -49,6 +49,8 @@ Other Changes: - Windows: fixed an issue where resizable child windows would emit border logic when hidden/non-visible (e.g. when in a docked window that is not selected), impacting code not checking for BeginChild() return value. (#8815) +- Textures: Fixed support for `#define ImTextureID_Invalid` to non-zero value: + ImFontAtlas() was incorrectly cleared with zeroes. (#8860, #8745) [@cfillion] - Tables: fixed TableGetRowIndex() which never correctly worked when using a clipper (it exists for consistency but is almost never used, as it is often more convenient to use index in caller-code, whereas TableGetRowIndex() diff --git a/imgui_draw.cpp b/imgui_draw.cpp index 64f9a9f7a..399fc4822 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -2631,6 +2631,7 @@ ImFontAtlas::ImFontAtlas() TexMinHeight = 128; TexMaxWidth = 8192; TexMaxHeight = 8192; + TexRef._TexID = ImTextureID_Invalid; RendererHasTextures = false; // Assumed false by default, as apps can call e.g Atlas::Build() after backend init and before ImGui can update. TexNextUniqueID = 1; FontNextUniqueID = 1;