Turtle Dove d424c48c1b OpenGL2: Defer texture destruction until UnusedFrames > 0 (#9475)
The OpenGL2 backend was immediately destroying textures on
ImTextureStatus_WantDestroy without checking tex->UnusedFrames > 0,
unlike ALL other backends (OpenGL3, DX11, DX12, Metal, Vulkan, WebGPU)
which defer destruction until the texture is no longer in use by the GPU.

This could cause a use-after-free if the texture was still referenced by
in-flight draw commands when it was destroyed.

Fix: Add '&& tex->UnusedFrames > 0' to the WantDestroy check, matching
the pattern used by OpenGL3, DX11, Metal, Vulkan, and WebGPU.
2026-07-16 08:28:39 -05:00
..
2026-01-20 18:25:18 +01:00