From d4be71f35f5a5f127a611a2c2daa3410c23ce55e Mon Sep 17 00:00:00 2001 From: thedmd Date: Wed, 30 Jun 2021 17:35:50 +0200 Subject: [PATCH] WIP. DX9: Prevent use textures released in ImGui_ImplDX9_InvalidateDeviceObjects --- backends/imgui_impl_dx9.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backends/imgui_impl_dx9.cpp b/backends/imgui_impl_dx9.cpp index 4097ecc41692..82c01bf6a90f 100644 --- a/backends/imgui_impl_dx9.cpp +++ b/backends/imgui_impl_dx9.cpp @@ -443,6 +443,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 != NULL && new_texture != current_texture) textures.find_erase_unsorted(current_texture);