From 7298ad2a687491c35920d60847fa92fef3e466b5 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 27 Sep 2010 00:49:34 -0700 Subject: [PATCH] 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. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Kind regards, André --- src/video/SDL_video.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index c3dac58a0..e0dd19ad6 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -1447,7 +1447,6 @@ SDL_DestroyWindow(SDL_Window * window) SDL_VideoDisplay *display; CHECK_WINDOW_MAGIC(window, ); - window->magic = NULL; if (window->title) { SDL_free(window->title); @@ -1466,6 +1465,9 @@ SDL_DestroyWindow(SDL_Window * window) SDL_GL_UnloadLibrary(); } + /* Now invalidate magic */ + window->magic = NULL; + /* Unlink the window from the list */ display = window->display; if (window->next) {