1
0
Fork 0
mirror of https://github.com/ocornut/imgui.git synced 2026-01-11 00:04:24 +00:00

Textures: fixed an issue preventing multi-contexts from using each others' fonts if context 2 runs after context 1's Render() function. (#9039)

This commit is contained in:
ocornut 2025-10-31 16:37:42 +01:00
parent db577cd445
commit 505ff536f9
2 changed files with 9 additions and 0 deletions

View file

@ -60,6 +60,9 @@ Other Changes:
resizing the parent window while keeping the multi-line field active (which is
most typically achieved when resizing programmatically or via a docking layout
reacting to a platform window resize). (#3237, #9007) [@anton-kl, @ocornut]
- Textures:
- Fixed an issue preventing multi-contexts from using each others' fonts
if context 2 runs after context 1's Render() function. (#9039)
- MultiSelect: added ImGuiMultiSelectFlags_NoSelectOnRightClick to disable default
right-click processing, which selects item on mouse down and is designed for
context-menus. (#8200, #9015)

View file

@ -3909,6 +3909,11 @@ void ImFontAtlasRemoveDrawListSharedData(ImFontAtlas* atlas, ImDrawListSharedDat
void ImFontAtlasUpdateDrawListsTextures(ImFontAtlas* atlas, ImTextureRef old_tex, ImTextureRef new_tex)
{
for (ImDrawListSharedData* shared_data : atlas->DrawListSharedDatas)
{
// If Context 2 uses font owned by Context 1 which already called EndFrame()/Render(), we don't want to mess with draw commands for Context 1
if (shared_data->Context && !shared_data->Context->WithinFrameScope)
continue;
for (ImDrawList* draw_list : shared_data->DrawLists)
{
// Replace in command-buffer
@ -3922,6 +3927,7 @@ void ImFontAtlasUpdateDrawListsTextures(ImFontAtlas* atlas, ImTextureRef old_tex
if (stacked_tex == old_tex)
stacked_tex = new_tex;
}
}
}
// Update texture coordinates in all draw list shared context