From cb4c03756a825516f66ddd6e981ef284ab6a20ba Mon Sep 17 00:00:00 2001 From: ocornut Date: Wed, 19 Mar 2025 19:57:03 +0100 Subject: [PATCH] Fonts: detect if backend assign to texture on creation but doesn't update Status. --- imgui_draw.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/imgui_draw.cpp b/imgui_draw.cpp index 8ecc2ecdb..991b45f8d 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -2765,10 +2765,12 @@ void ImFontAtlasUpdateNewFrame(ImFontAtlas* atlas, int frame_count) tex->UpdateRect.x = tex->UpdateRect.y = (unsigned short)~0; tex->UpdateRect.w = tex->UpdateRect.h = 0; } + if (tex->Status == ImTextureStatus_WantCreate && atlas->RendererHasTextures) + IM_ASSERT(tex->TexID == ImTextureID_Invalid && tex->BackendUserData == NULL && "Backend set texture's TexID/BackendUserData but did not update Status to OK."); if (tex->Status == ImTextureStatus_Destroyed) { - IM_ASSERT(tex->TexID == ImTextureID_Invalid && tex->BackendUserData == NULL); + IM_ASSERT(tex->TexID == ImTextureID_Invalid && tex->BackendUserData == NULL && "Backend set texture Status to Destroyed but did not clear TexID/BackendUserData!"); if (tex->WantDestroyNextFrame) remove_from_list = true; // Destroy was scheduled by us else