aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2011-09-12 03:35:21 -0700
committerChris Robinson <[email protected]>2011-09-12 03:35:21 -0700
commit69b10e2d7c4817bca90b175b2d43609ff97686a9 (patch)
tree732c30463ea384b9964e4e4e77afb7fc03c14306 /Alc
parent25e86e8e91eaa024deddb381fe62353bcd34f3b9 (diff)
Remove the context from being current before removing it from the device
Diffstat (limited to 'Alc')
-rw-r--r--Alc/ALc.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 3ba020f5..a6787df6 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -1467,6 +1467,19 @@ static void ReleaseContext(ALCcontext *context, ALCdevice *device)
{
ALCcontext *volatile*tmp_ctx;
+ if(pthread_getspecific(LocalContext) == context)
+ {
+ WARN("%p released while current on thread\n", context);
+ pthread_setspecific(LocalContext, NULL);
+ ALCcontext_DecRef(context);
+ }
+
+ if(CompExchangePtr((void**)&GlobalContext, context, NULL))
+ {
+ WARN("%p released while current\n", context);
+ ALCcontext_DecRef(context);
+ }
+
tmp_ctx = &device->ContextList;
while(*tmp_ctx)
{
@@ -1484,19 +1497,6 @@ static void ReleaseContext(ALCcontext *context, ALCdevice *device)
* efficient way of doing this. */
UnlockDevice(device);
- if(pthread_getspecific(LocalContext) == context)
- {
- WARN("%p released while current on thread\n", context);
- pthread_setspecific(LocalContext, NULL);
- ALCcontext_DecRef(context);
- }
-
- if(CompExchangePtr((void**)&GlobalContext, context, NULL))
- {
- WARN("%p released while current\n", context);
- ALCcontext_DecRef(context);
- }
-
ALCcontext_DecRef(context);
}