Skip to content

Commit

Permalink
WIP. DX9: Prevent use textures released in ImGui_ImplDX9_InvalidateDe…
Browse files Browse the repository at this point in the history
…viceObjects
  • Loading branch information
thedmd authored and ocornut committed Apr 19, 2024
1 parent eebcad7 commit e915a19
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions backends/imgui_impl_dx9.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,9 @@ void ImGui_ImplDX9_UpdateTextures()
{
in_tex_data->EnsureFormat(ImTextureFormat_RGBA32);

if (current_texture != NULL && textures.find(current_texture) == textures.end())
current_texture = NULL; // Make sure we do not access textures released by ImGui_ImplDX9_InvalidateDeviceObjects()

LPDIRECT3DTEXTURE9 new_texture = ImGui_ImplDX9_UpdateTexture(current_texture, in_tex_data);
if (current_texture != nullptr && new_texture != current_texture)
textures.find_erase_unsorted(current_texture);
Expand Down

0 comments on commit e915a19

Please sign in to comment.