comparison src/video/SDL_video.c @ 4897:c3eb55210a90

SDL_DestroyWindow is setting window->magic to NULL too early. - window->magic is also checked in SDL_DestroyRenderer. All cleanup code like freeing the renderer and textures is not executed. The patch moves window_magic = NULL behind the SDL_DestroyRenderer call. Kind regards, André
author Sam Lantinga <slouken@libsdl.org>
date Mon, 27 Sep 2010 00:49:34 -0700
parents 231f8a1c5edd
children 69d9db65f248
comparison
equal deleted inserted replaced
4896:d72e28642940 4897:c3eb55210a90
1445 SDL_DestroyWindow(SDL_Window * window) 1445 SDL_DestroyWindow(SDL_Window * window)
1446 { 1446 {
1447 SDL_VideoDisplay *display; 1447 SDL_VideoDisplay *display;
1448 1448
1449 CHECK_WINDOW_MAGIC(window, ); 1449 CHECK_WINDOW_MAGIC(window, );
1450 window->magic = NULL;
1451 1450
1452 if (window->title) { 1451 if (window->title) {
1453 SDL_free(window->title); 1452 SDL_free(window->title);
1454 } 1453 }
1455 if (window->renderer) { 1454 if (window->renderer) {
1463 _this->DestroyWindow(_this, window); 1462 _this->DestroyWindow(_this, window);
1464 } 1463 }
1465 if (window->flags & SDL_WINDOW_OPENGL) { 1464 if (window->flags & SDL_WINDOW_OPENGL) {
1466 SDL_GL_UnloadLibrary(); 1465 SDL_GL_UnloadLibrary();
1467 } 1466 }
1467
1468 /* Now invalidate magic */
1469 window->magic = NULL;
1468 1470
1469 /* Unlink the window from the list */ 1471 /* Unlink the window from the list */
1470 display = window->display; 1472 display = window->display;
1471 if (window->next) { 1473 if (window->next) {
1472 window->next->prev = window->prev; 1474 window->next->prev = window->prev;