mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-17 00:38:12 +00:00
Don't create a TLS error buffer if we're just clearing the error
Fixes https://github.com/libsdl-org/SDL/issues/7600
This commit is contained in:
@@ -212,7 +212,7 @@ static void SDLCALL SDL_FreeErrBuf(void *data)
|
||||
#endif
|
||||
|
||||
/* Routine to get the thread-specific error variable */
|
||||
SDL_error *SDL_GetErrBuf(void)
|
||||
SDL_error *SDL_GetErrBuf(SDL_bool create)
|
||||
{
|
||||
#ifdef SDL_THREADS_DISABLED
|
||||
return SDL_GetStaticErrBuf();
|
||||
@@ -223,6 +223,10 @@ SDL_error *SDL_GetErrBuf(void)
|
||||
const SDL_error *ALLOCATION_IN_PROGRESS = (SDL_error *)-1;
|
||||
SDL_error *errbuf;
|
||||
|
||||
if (!tls_errbuf && !create) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* tls_being_created is there simply to prevent recursion if SDL_CreateTLS() fails.
|
||||
It also means it's possible for another thread to also use SDL_global_errbuf,
|
||||
but that's very unlikely and hopefully won't cause issues.
|
||||
|
Reference in New Issue
Block a user