From 4f59d372f8d98c91b5b48d5841e0d9d88b99dd06 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Tue, 11 Jun 2019 09:29:48 -0400 Subject: [PATCH] direct3d: don't dereference bogus pointer if current texture was destroyed. Fixes Bugzilla #4460. --- src/render/direct3d/SDL_render_d3d.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/render/direct3d/SDL_render_d3d.c b/src/render/direct3d/SDL_render_d3d.c index d25277502..e59357353 100644 --- a/src/render/direct3d/SDL_render_d3d.c +++ b/src/render/direct3d/SDL_render_d3d.c @@ -1501,8 +1501,13 @@ D3D_RenderPresent(SDL_Renderer * renderer) static void D3D_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture) { + D3D_RenderData *renderdata = (D3D_RenderData *) renderer->driverdata; D3D_TextureData *data = (D3D_TextureData *) texture->driverdata; + if (renderdata->drawstate.texture == texture) { + renderdata->drawstate.texture = NULL; + } + if (!data) { return; }