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

Fonts: fixed a crash when modifying different texture format with a legacy backend. (#8824)

This commit is contained in:
Elliot Prior 2025-07-22 18:21:43 +01:00 committed by ocornut
parent 7e701c18c8
commit ff2dfc8422
2 changed files with 4 additions and 5 deletions

View file

@ -50,6 +50,9 @@ Other Changes:
specified but the target font doesn't. Usually either all fonts should specified but the target font doesn't. Usually either all fonts should
have a reference size (only required when specifying e.g. GlyphOffset), have a reference size (only required when specifying e.g. GlyphOffset),
or none should have a reference size. or none should have a reference size.
- Fonts: fixed a crash when changing texture format when using a legacy
backend. Most commonly would happen when calling GetTexDataAsRGBA32()
then immediately GetTexDataAsAlpha8(). (#8824)
- Windows: fixed an issue where resizable child windows would emit border - Windows: fixed an issue where resizable child windows would emit border
logic when hidden/non-visible (e.g. when in a docked window that is not logic when hidden/non-visible (e.g. when in a docked window that is not
selected), impacting code not checking for BeginChild() return value. (#8815) selected), impacting code not checking for BeginChild() return value. (#8815)

View file

@ -3363,11 +3363,7 @@ void ImFontAtlasBuildMain(ImFontAtlas* atlas)
{ {
IM_ASSERT(!atlas->Locked && "Cannot modify a locked ImFontAtlas!"); IM_ASSERT(!atlas->Locked && "Cannot modify a locked ImFontAtlas!");
if (atlas->TexData && atlas->TexData->Format != atlas->TexDesiredFormat) if (atlas->TexData && atlas->TexData->Format != atlas->TexDesiredFormat)
{ ImFontAtlasBuildClear(atlas);
ImVec2i new_tex_size = ImFontAtlasTextureGetSizeEstimate(atlas);
ImFontAtlasBuildDestroy(atlas);
ImFontAtlasTextureAdd(atlas, new_tex_size.x, new_tex_size.y);
}
if (atlas->Builder == NULL) if (atlas->Builder == NULL)
ImFontAtlasBuildInit(atlas); ImFontAtlasBuildInit(atlas);