From 4d66a4202641802b4b5b81d7a0d8be0d817aeb8e Mon Sep 17 00:00:00 2001 From: AndySockmonsters Date: Tue, 17 Mar 2020 08:48:12 +0000 Subject: [PATCH] - Comment SDL memory leak --- src/SDL.c | 4 +++- src/thread/SDL_thread.c | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/SDL.c b/src/SDL.c index 820253df..b316e717 100644 --- a/src/SDL.c +++ b/src/SDL.c @@ -406,9 +406,11 @@ SDL_WasInit(Uint32 flags) return initialized; } +/* This is not exposed in a header because calling it anywhere other than + * here, or in SDL_thread.c is likely to end in disaster. + */ extern void SDL_TLSCleanup(); - void SDL_Quit(void) { diff --git a/src/thread/SDL_thread.c b/src/thread/SDL_thread.c index 5d9ac231..876a9e61 100644 --- a/src/thread/SDL_thread.c +++ b/src/thread/SDL_thread.c @@ -83,6 +83,10 @@ SDL_TLSSet(SDL_TLSID id, const void *value, void (SDLCALL *destructor)(void *)) return 0; } +/* This function is called from SDL_Quit so don't make it static. It's not + in the header because calling it anywhere except there or here will + be a disaster +*/ void SDL_TLSCleanup() { -- 2.24.1.windows.2 From 4e6121010f6dd6c3e44ecb34a2bc1ca6d30037a6 Mon Sep 17 00:00:00 2001 From: AndyAntstream Date: Mon, 16 Mar 2020 19:06:28 +0000 Subject: [PATCH] - Fix memory leak --- src/SDL.c | 5 +++++ src/thread/SDL_thread.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/SDL.c b/src/SDL.c index 680ed2e7..820253df 100644 --- a/src/SDL.c +++ b/src/SDL.c @@ -406,6 +406,9 @@ SDL_WasInit(Uint32 flags) return initialized; } +extern void SDL_TLSCleanup(); + + void SDL_Quit(void) { @@ -424,6 +427,8 @@ SDL_Quit(void) SDL_ClearHints(); SDL_AssertionsQuit(); SDL_LogResetPriorities(); + + SDL_TLSCleanup(); /* Now that every subsystem has been quit, we reset the subsystem refcount * and the list of initialized subsystems. diff --git a/src/thread/SDL_thread.c b/src/thread/SDL_thread.c index c53ddcd0..5d9ac231 100644 --- a/src/thread/SDL_thread.c +++ b/src/thread/SDL_thread.c @@ -83,7 +83,7 @@ SDL_TLSSet(SDL_TLSID id, const void *value, void (SDLCALL *destructor)(void *)) return 0; } -static void +void SDL_TLSCleanup() { SDL_TLSData *storage; -- 2.24.1.windows.2