From 2cd2834dfe07ab4e9106ee85659a802818c35d08 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 4 Feb 2025 23:49:12 -0800 Subject: [PATCH] Fixed memory leak in the pen cleanup Fixes https://github.com/libsdl-org/SDL/issues/12099 --- src/video/SDL_video.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index f30de9fe7a..37fd8bb28a 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -4294,7 +4294,9 @@ void SDL_VideoQuit(void) } // Halt event processing before doing anything else +#if 0 // This was moved to the end to fix a memory leak SDL_QuitPen(); +#endif SDL_QuitTouch(); SDL_QuitMouse(); SDL_QuitKeyboard(); @@ -4325,6 +4327,9 @@ void SDL_VideoQuit(void) } _this->free(_this); _this = NULL; + + // This needs to happen after the video subsystem has removed pen data + SDL_QuitPen(); } bool SDL_GL_LoadLibrary(const char *path)