From 624905a7f17dfd0bdc158e8ade58946a3f7a1f7e Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 7 Nov 2023 21:44:18 -0800 Subject: [PATCH] Destroy the window surface if we've created it for the software renderer Fixes https://github.com/libsdl-org/SDL/issues/8011 --- src/render/software/SDL_render_sw.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/render/software/SDL_render_sw.c b/src/render/software/SDL_render_sw.c index edf492327..7ba51a8e2 100644 --- a/src/render/software/SDL_render_sw.c +++ b/src/render/software/SDL_render_sw.c @@ -980,8 +980,12 @@ static void SW_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture) static void SW_DestroyRenderer(SDL_Renderer *renderer) { + SDL_Window *window = renderer->window; SW_RenderData *data = (SW_RenderData *)renderer->driverdata; + if (window) { + SDL_DestroyWindowSurface(window); + } SDL_free(data); SDL_free(renderer); } @@ -1035,8 +1039,6 @@ SDL_Renderer *SW_CreateRendererForSurface(SDL_Surface *surface) renderer->info = SW_RenderDriver.info; renderer->driverdata = data; - SW_ActivateRenderer(renderer); - return renderer; }