diff --git a/gfx/common/d3d_common.cpp b/gfx/common/d3d_common.cpp index f7c743113b..74df2926c0 100644 --- a/gfx/common/d3d_common.cpp +++ b/gfx/common/d3d_common.cpp @@ -79,7 +79,6 @@ void d3d_texture_free(LPDIRECT3DTEXTURE tex) { if (tex) tex->Release(); - tex = NULL; } bool d3d_vertex_declaration_new(LPDIRECT3DDEVICE dev, diff --git a/gfx/d3d/d3d.cpp b/gfx/d3d/d3d.cpp index 106b2ba014..7de8f4deee 100644 --- a/gfx/d3d/d3d.cpp +++ b/gfx/d3d/d3d.cpp @@ -1782,10 +1782,12 @@ static uintptr_t d3d_load_texture(void *video_data, void *data, static void d3d_unload_texture(void *data, uintptr_t *id) { + LPDIRECT3DTEXTURE texid = (LPDIRECT3DTEXTURE)id; if (!id) return; - d3d_texture_free((LPDIRECT3DTEXTURE)id); + d3d_texture_free(texid); + *id = NULL; } static const video_poke_interface_t d3d_poke_interface = {