aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/ALc.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2012-01-01 15:22:58 -0800
committerChris Robinson <[email protected]>2012-01-01 15:22:58 -0800
commit5500ed9209be44fc42b7f2eae0e49ebdb84e43b5 (patch)
tree4eb86efc5ab0a75cb45edf75eaab5945d47acc1e /Alc/ALc.c
parent886f874ff3025fac7bd07b9439f8ecc3b78fcc36 (diff)
Use the device lock when removing the context from the device's list
Diffstat (limited to 'Alc/ALc.c')
-rw-r--r--Alc/ALc.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index a9b8a84c..e39ca2e7 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -1463,21 +1463,14 @@ static void ReleaseContext(ALCcontext *context, ALCdevice *device)
ALCcontext_DecRef(context);
}
+ LockDevice(device);
tmp_ctx = &device->ContextList;
while(*tmp_ctx)
{
- if(*tmp_ctx == context)
- {
- *tmp_ctx = context->next;
+ if(CompExchangePtr((XchgPtr*)tmp_ctx, context, context->next))
break;
- }
tmp_ctx = &(*tmp_ctx)->next;
}
-
- LockDevice(device);
- /* Lock the device to make sure the mixer is not using the contexts in the
- * list before we go about deleting this one. There should be a more
- * efficient way of doing this. */
UnlockDevice(device);
ALCcontext_DecRef(context);