Browse Source

Fixed memory leak in the pen cleanup

Fixes https://github.com/libsdl-org/SDL/issues/12099
Sam Lantinga 6 months ago
parent
commit
2cd2834dfe
1 changed files with 5 additions and 0 deletions
  1. 5 0
      src/video/SDL_video.c

+ 5 - 0
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)