Skip to content

Commit ff2dfc8

Browse files
Quoguocornut
authored andcommitted
Fonts: fixed a crash when modifying different texture format with a legacy backend. (#8824)
1 parent 7e701c1 commit ff2dfc8

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

docs/CHANGELOG.txt

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

imgui_draw.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3363,11 +3363,7 @@ void ImFontAtlasBuildMain(ImFontAtlas* atlas)
33633363
{
33643364
IM_ASSERT(!atlas->Locked && "Cannot modify a locked ImFontAtlas!");
33653365
if (atlas->TexData && atlas->TexData->Format != atlas->TexDesiredFormat)
3366-
{
3367-
ImVec2i new_tex_size = ImFontAtlasTextureGetSizeEstimate(atlas);
3368-
ImFontAtlasBuildDestroy(atlas);
3369-
ImFontAtlasTextureAdd(atlas, new_tex_size.x, new_tex_size.y);
3370-
}
3366+
ImFontAtlasBuildClear(atlas);
33713367

33723368
if (atlas->Builder == NULL)
33733369
ImFontAtlasBuildInit(atlas);

0 commit comments

Comments
 (0)