foxygit / doom Log in
commit cd58413157fdae20e56fcd21971ac974b7d09693
Author:     ceski <56656010+ceski-1@users.noreply.github.com>
AuthorDate: Wed Jun 11 02:49:33 2025 -0700
Commit:     GitHub <noreply@github.com>
CommitDate: Wed Jun 11 11:49:33 2025 +0200

    Free SDL video resources on shutdown (#1743)

    * Free/destroy SDL video resources on shutdown

    * Simplify
---
 src/i_video.c        | 6 ++++++
 textscreen/txt_sdl.c | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/src/i_video.c b/src/i_video.c
index 01e13102..45e417c6 100644
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -276,6 +276,12 @@ void I_ShutdownGraphics(void)
     {
         SetShowCursor(true);

+        SDL_FreeSurface(argbbuffer);
+        SDL_FreeSurface(screenbuffer);
+        SDL_DestroyTexture(texture_upscaled);
+        SDL_DestroyTexture(texture);
+        SDL_DestroyRenderer(renderer);
+        SDL_DestroyWindow(screen);
         SDL_QuitSubSystem(SDL_INIT_VIDEO);

         initialized = false;
diff --git a/textscreen/txt_sdl.c b/textscreen/txt_sdl.c
index eed61676..807a1954 100644
--- a/textscreen/txt_sdl.c
+++ b/textscreen/txt_sdl.c
@@ -311,6 +311,8 @@ void TXT_Shutdown(void)
     screendata = NULL;
     SDL_FreeSurface(screenbuffer);
     screenbuffer = NULL;
+    SDL_DestroyRenderer(renderer);
+    SDL_DestroyWindow(TXT_SDLWindow);
     SDL_QuitSubSystem(SDL_INIT_VIDEO);
 }