From 102789d4487a8dbbb13a131dde3d21a612e86adb Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Fri, 28 Apr 2023 22:28:32 -0700 Subject: Unset sLocalContext when releasing it --- alc/context.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'alc') diff --git a/alc/context.cpp b/alc/context.cpp index e02c549b..008c2bf4 100644 --- a/alc/context.cpp +++ b/alc/context.cpp @@ -93,7 +93,7 @@ std::atomic ALCcontext::sGlobalContext{nullptr}; thread_local ALCcontext *ALCcontext::sLocalContext{nullptr}; ALCcontext::ThreadCtx::~ThreadCtx() { - if(ALCcontext *ctx{ALCcontext::sLocalContext}) + if(ALCcontext *ctx{std::exchange(ALCcontext::sLocalContext, nullptr)}) { const bool result{ctx->releaseIfNoDelete()}; ERR("Context %p current for thread being destroyed%s!\n", voidp{ctx}, -- cgit v1.2.3