DrawList: reworked assert in PushTexture() to allow convenience grace period of using texture already queued for destroy during the same frame. (#9528, #8465)

Amend 131f5c57ab
This commit is contained in:
ocornut
2026-09-01 16:21:37 +02:00
parent e0537bf72b
commit f562ab8e32
3 changed files with 5 additions and 2 deletions

View File

@@ -70,6 +70,9 @@ Other Changes:
- Per-viewport FramebufferScale for Apple/Retina screen is applied to draw lists:
- AA Fringe is scaled accordingly.
- Circle and Curves tessellation error are scaled accordingly.
- Reworked assert in PushTexture() to allow convenience grace period of using a
texture that was queue for destroy during the frame. Make it safe to stick to
an existing texture during the frame. (#9528, #8465)
- Backends:
- QNX: added QNX Screen backend. (#9492) [@mgorchak-blackberry]
- SDL2: fixed querying framebuffer scale/density when using Metal without

View File

@@ -16812,7 +16812,7 @@ void ImGui::DebugNodeTexture(ImTextureData* tex, int int_id, const ImFontAtlasRe
Checkbox("Show used rect", &cfg->ShowTextureUsedRect);
PushStyleVar(ImGuiStyleVar_ImageBorderSize, ImMax(1.0f, g.Style.ImageBorderSize));
ImVec2 p = GetCursorScreenPos();
if (tex->WantDestroyNextFrame)
if (tex->Status == ImTextureStatus_WantDestroy || tex->Status == ImTextureStatus_Destroyed)
Dummy(ImVec2((float)tex->Width, (float)tex->Height));
else
ImageWithBg(tex->GetTexRef(), ImVec2((float)tex->Width, (float)tex->Height), ImVec2(0.0f, 0.0f), ImVec2(1.0f, 1.0f), ImVec4(0.0f, 0.0f, 0.0f, 1.0f));

View File

@@ -699,7 +699,7 @@ void ImDrawList::PushTexture(ImTextureRef tex_ref)
_TextureStack.push_back(tex_ref);
_CmdHeader.TexRef = tex_ref;
if (tex_ref._TexData != NULL)
IM_ASSERT(tex_ref._TexData->WantDestroyNextFrame == false);
IM_ASSERT(tex_ref._TexData->Status != ImTextureStatus_WantDestroy && tex_ref._TexData->Status != ImTextureStatus_Destroyed);
_OnChangedTexture();
}