From 822903e56debba39530ecc3bebfdf7709737c217 Mon Sep 17 00:00:00 2001 From: ocornut Date: Fri, 16 May 2025 16:55:29 +0200 Subject: [PATCH] Fonts: fixed ImFontAtlas::RemoveFont() with multiple sources. Thanks cyfewlp! --- imgui_draw.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/imgui_draw.cpp b/imgui_draw.cpp index 6306e9c75..3d719820f 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -3205,10 +3205,10 @@ void ImFontAtlas::RemoveFont(ImFont* font) ImFontAtlasFontDestroyOutput(this, font); for (ImFontConfig* src : font->Sources) - { ImFontAtlasFontDestroySourceData(this, src); - Sources.erase(src); - } + for (int src_n = 0; src_n < Sources.Size; src_n++) + if (Sources[src_n].DstFont == font) + Sources.erase(&Sources[src_n--]); bool removed = Fonts.find_erase(font); IM_ASSERT(removed);