direct3d: don't dereference bogus pointer if current texture was destroyed.
authorRyan C. Gordon <icculus@icculus.org>
Tue, 11 Jun 2019 09:29:48 -0400
changeset 128325b0c4bfbd083
parent 12830 370a2c6f5a1d
child 12833 8a5ef22c9e13
direct3d: don't dereference bogus pointer if current texture was destroyed.

Fixes Bugzilla #4460.
src/render/direct3d/SDL_render_d3d.c
     1.1 --- a/src/render/direct3d/SDL_render_d3d.c	Tue Jun 11 11:01:15 2019 +0200
     1.2 +++ b/src/render/direct3d/SDL_render_d3d.c	Tue Jun 11 09:29:48 2019 -0400
     1.3 @@ -1501,8 +1501,13 @@
     1.4  static void
     1.5  D3D_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture)
     1.6  {
     1.7 +    D3D_RenderData *renderdata = (D3D_RenderData *) renderer->driverdata;
     1.8      D3D_TextureData *data = (D3D_TextureData *) texture->driverdata;
     1.9  
    1.10 +    if (renderdata->drawstate.texture == texture) {
    1.11 +        renderdata->drawstate.texture = NULL;
    1.12 +    }
    1.13 +
    1.14      if (!data) {
    1.15          return;
    1.16      }