From 60435712f2c9bffb7c244c69f8e406e9854f9376 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 3 Jun 2020 16:42:19 -0400 Subject: [PATCH] video: Set window->surface NULL after freeing it. Otherwise, when SDL_CreateWindowFramebuffer() is called again, it will return the free'd surface instead of creating a new one. --- src/video/SDL_video.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index bebd566c7..dabdd8f24 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -2374,6 +2374,7 @@ SDL_GetWindowSurface(SDL_Window * window) if (window->surface) { window->surface->flags &= ~SDL_DONTFREE; SDL_FreeSurface(window->surface); + window->surface = NULL; } window->surface = SDL_CreateWindowFramebuffer(window); if (window->surface) {