浏览代码

Fonts: Fixed _OnChangedTextureID() asserting when calling on e.g. finalized drawlists.

ocornut 7 月之前
父节点
当前提交
066b24d741
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      imgui_draw.cpp

+ 4 - 1
imgui_draw.cpp

@@ -599,7 +599,10 @@ void ImDrawList::_OnChangedTexture()
         AddDrawCmd();
         AddDrawCmd();
         return;
         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
     // Try to merge with previous command if it matches, else use current command
     ImDrawCmd* prev_cmd = curr_cmd - 1;
     ImDrawCmd* prev_cmd = curr_cmd - 1;