Fonts: fixed an issue where passing a manually created ImFontAtlas to CreateContext() would incorrectly destroy it in DestroyContext() when ref-count gets back to zero. (#9426)

# Conflicts:
#	docs/CHANGELOG.txt
This commit is contained in:
ocornut
2026-06-02 19:05:40 +02:00
parent 5a42cddcd2
commit c4eaac6d48
2 changed files with 3 additions and 1 deletions
+2
View File
@@ -60,6 +60,8 @@ Other Changes:
disable embedding either fonts separately. (#9407) disable embedding either fonts separately. (#9407)
- Tweak `CalcTextSize()` awkward width rounding/ceiling code to reduce floating-point - Tweak `CalcTextSize()` awkward width rounding/ceiling code to reduce floating-point
imprecisions altering the result by 1 even at relatively small width. (#791) imprecisions altering the result by 1 even at relatively small width. (#791)
- Fixed an issue where passing a manually created ImFontAtlas to CreateContext() would
incorrectly destroy it in DestroyContext() when ref-count gets back to zero. (#9426)
- DrawList: - DrawList:
- Minor optimization to `AddLine()`, `AddLineH()`, `AddLineV()` functions. (#4091) - Minor optimization to `AddLine()`, `AddLineH()`, `AddLineV()` functions. (#4091)
- Added `ImDrawListFlags_TextNoPixelSnap` to disable snapping of AddText() - Added `ImDrawListFlags_TextNoPixelSnap` to disable snapping of AddText()
+1 -1
View File
@@ -4476,7 +4476,7 @@ void ImGui::Shutdown()
for (ImFontAtlas* atlas : g.FontAtlases) for (ImFontAtlas* atlas : g.FontAtlases)
{ {
UnregisterFontAtlas(atlas); UnregisterFontAtlas(atlas);
if (atlas->RefCount == 0) if (atlas->RefCount == 0 && atlas->OwnerContext == &g)
{ {
atlas->Locked = false; atlas->Locked = false;
IM_DELETE(atlas); IM_DELETE(atlas);