aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/ALc.c
diff options
context:
space:
mode:
Diffstat (limited to 'Alc/ALc.c')
-rw-r--r--Alc/ALc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 5cc4a777..df2ba12c 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -2231,9 +2231,10 @@ ALC_API ALCboolean ALC_APIENTRY alcMakeContextCurrent(ALCcontext *context)
// context must be a valid Context or NULL
if(context == NULL || IsContext(context))
{
- ALCcontext *old = GlobalContext;
+ ALCcontext *old;
+
if(context) ALCcontext_IncRef(context);
- GlobalContext = context;
+ old = ExchangePtr((void**)&GlobalContext, context);
if(old) ALCcontext_DecRef(old);
if((old=pthread_getspecific(LocalContext)) != NULL)