Textures need to be freed before renderers
authorSam Lantinga <slouken@libsdl.org>
Mon, 18 Nov 2013 20:21:45 -0800
changeset 8011 126cd9fd8b61
parent 8010 ffd65b452bd2
child 8012 6516c66db5c9
Textures need to be freed before renderers
src/test/SDL_test_common.c
--- a/src/test/SDL_test_common.c	Mon Nov 18 23:45:46 2013 +0100
+++ b/src/test/SDL_test_common.c	Mon Nov 18 20:21:45 2013 -0800
@@ -951,7 +951,7 @@
 {
     if ((event->type == SDL_MOUSEMOTION) || (event->type == SDL_FINGERMOTION)) {
         /* Mouse and finger motion are really spammy */
-        return;
+        //return;
     }
 
     fprintf(stderr, "SDL EVENT: ");
@@ -1416,6 +1416,14 @@
     int i;
 
     SDL_free(state->windows);
+    if (state->targets) {
+        for (i = 0; i < state->num_windows; ++i) {
+            if (state->targets[i]) {
+                SDL_DestroyTexture(state->targets[i]);
+            }
+        }
+        SDL_free(state->targets);
+    }
     if (state->renderers) {
         for (i = 0; i < state->num_windows; ++i) {
             if (state->renderers[i]) {
@@ -1424,14 +1432,6 @@
         }
         SDL_free(state->renderers);
     }
-    if (state->targets) {
-        for (i = 0; i < state->num_windows; ++i) {
-            if (state->targets[i]) {
-                SDL_DestroyTexture(state->targets[i]);
-            }
-        }
-        SDL_free(state->targets);
-    }
     if (state->flags & SDL_INIT_VIDEO) {
         SDL_VideoQuit();
     }