Textures need to be freed before renderers
authorSam Lantinga <slouken@libsdl.org>
Mon, 18 Nov 2013 20:21:45 -0800
changeset 8011126cd9fd8b61
parent 8010 ffd65b452bd2
child 8012 6516c66db5c9
Textures need to be freed before renderers
src/test/SDL_test_common.c
     1.1 --- a/src/test/SDL_test_common.c	Mon Nov 18 23:45:46 2013 +0100
     1.2 +++ b/src/test/SDL_test_common.c	Mon Nov 18 20:21:45 2013 -0800
     1.3 @@ -951,7 +951,7 @@
     1.4  {
     1.5      if ((event->type == SDL_MOUSEMOTION) || (event->type == SDL_FINGERMOTION)) {
     1.6          /* Mouse and finger motion are really spammy */
     1.7 -        return;
     1.8 +        //return;
     1.9      }
    1.10  
    1.11      fprintf(stderr, "SDL EVENT: ");
    1.12 @@ -1416,6 +1416,14 @@
    1.13      int i;
    1.14  
    1.15      SDL_free(state->windows);
    1.16 +    if (state->targets) {
    1.17 +        for (i = 0; i < state->num_windows; ++i) {
    1.18 +            if (state->targets[i]) {
    1.19 +                SDL_DestroyTexture(state->targets[i]);
    1.20 +            }
    1.21 +        }
    1.22 +        SDL_free(state->targets);
    1.23 +    }
    1.24      if (state->renderers) {
    1.25          for (i = 0; i < state->num_windows; ++i) {
    1.26              if (state->renderers[i]) {
    1.27 @@ -1424,14 +1432,6 @@
    1.28          }
    1.29          SDL_free(state->renderers);
    1.30      }
    1.31 -    if (state->targets) {
    1.32 -        for (i = 0; i < state->num_windows; ++i) {
    1.33 -            if (state->targets[i]) {
    1.34 -                SDL_DestroyTexture(state->targets[i]);
    1.35 -            }
    1.36 -        }
    1.37 -        SDL_free(state->targets);
    1.38 -    }
    1.39      if (state->flags & SDL_INIT_VIDEO) {
    1.40          SDL_VideoQuit();
    1.41      }