Don't crash if the current render target is destroyed.
authorSam Lantinga <slouken@libsdl.org>
Fri, 12 Jul 2013 00:43:16 -0700
changeset 7419a22566f42281
parent 7418 5689b9b47f8c
child 7420 fe82b639c4d6
Don't crash if the current render target is destroyed.
src/render/SDL_render.c
     1.1 --- a/src/render/SDL_render.c	Fri Jul 12 09:55:58 2013 +0300
     1.2 +++ b/src/render/SDL_render.c	Fri Jul 12 00:43:16 2013 -0700
     1.3 @@ -1691,9 +1691,14 @@
     1.4      SDL_Renderer *renderer;
     1.5  
     1.6      CHECK_TEXTURE_MAGIC(texture, );
     1.7 +
     1.8 +    renderer = texture->renderer;
     1.9 +    if (texture == renderer->target) {
    1.10 +        SDL_SetRenderTarget(renderer, NULL);
    1.11 +    }
    1.12 +
    1.13      texture->magic = NULL;
    1.14  
    1.15 -    renderer = texture->renderer;
    1.16      if (texture->next) {
    1.17          texture->next->prev = texture->prev;
    1.18      }