src/video/SDL_video.c
changeset 2328 91e601d9df8b
parent 2324 3202e4826c57
child 2357 ad4a291c85ab
child 2540 56cf872c723a
child 2669 e27bdcc80744
--- a/src/video/SDL_video.c	Fri Mar 07 23:57:15 2008 +0000
+++ b/src/video/SDL_video.c	Fri Mar 14 18:17:49 2008 +0000
@@ -1329,15 +1329,17 @@
             if (window->id != windowID) {
                 continue;
             }
+            if (window->title) {
+                SDL_free(window->title);
+                window->title = NULL;
+            }
             if (window->renderer) {
                 SDL_DestroyRenderer(window->id);
+                window->renderer = NULL;
             }
             if (_this->DestroyWindow) {
                 _this->DestroyWindow(_this, window);
             }
-            if (window->title) {
-                SDL_free(window->title);
-            }
             if (j != display->num_windows - 1) {
                 SDL_memcpy(&display->windows[i],
                            &display->windows[i + 1],
@@ -1439,9 +1441,8 @@
     SDL_DestroyRenderer(windowID);
 
     /* Create a new renderer instance */
-    window->renderer =
-        SDL_CurrentDisplay.render_drivers[index].CreateRenderer(window,
-                                                                flags);
+    window->renderer = SDL_CurrentDisplay.render_drivers[index]
+        .CreateRenderer(window, flags);
     SDL_SelectRenderer(window->id);
 
     return 0;
@@ -2220,9 +2221,11 @@
         }
         if (display->gamma) {
             SDL_free(display->gamma);
+            display->gamma = NULL;
         }
         if (display->driverdata) {
             SDL_free(display->driverdata);
+            display->driverdata = NULL;
         }
     }
     if (_this->displays) {