From 066b24d7416be6b1ad640adb0c3c0e66c39193a9 Mon Sep 17 00:00:00 2001 From: ocornut Date: Tue, 4 Feb 2025 20:02:10 +0100 Subject: [PATCH] Fonts: Fixed _OnChangedTextureID() asserting when calling on e.g. finalized drawlists. --- imgui_draw.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/imgui_draw.cpp b/imgui_draw.cpp index 921241185..0f3cf4dc8 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -599,7 +599,10 @@ void ImDrawList::_OnChangedTexture() AddDrawCmd(); return; } - IM_ASSERT(curr_cmd->UserCallback == NULL); + + // Unlike other _OnChangedXXX functions this may be called by ImFontAtlasUpdateDrawListsTextures() in more locations so we need to handle this case. + if (curr_cmd->UserCallback != NULL) + return; // Try to merge with previous command if it matches, else use current command ImDrawCmd* prev_cmd = curr_cmd - 1;