From 9f4baeea53b39ef20869a7ccd7d0b8fddba52726 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 8 Sep 2022 20:08:20 -0700 Subject: [PATCH] Clean up thread local storage when quitting SDL SDL_Quit() should be the last SDL API that you call before exiting your application, and is intended to clean up all internal state. If real-life applications are relying on thread-local storage after SDL_Quit() we could potentially add a hint to control this behavior. Fixes https://github.com/libsdl-org/SDL/issues/6200 --- src/SDL.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/SDL.c b/src/SDL.c index 59602d6236..643b5ca706 100644 --- a/src/SDL.c +++ b/src/SDL.c @@ -505,6 +505,8 @@ SDL_Quit(void) */ SDL_memset( SDL_SubsystemRefCount, 0x0, sizeof(SDL_SubsystemRefCount) ); + SDL_TLSCleanup(); + SDL_bInMainQuit = SDL_FALSE; }