aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
Diffstat (limited to 'Alc')
-rw-r--r--Alc/ALc.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 43e31d89..35c5607d 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -2653,15 +2653,15 @@ ALC_API ALCboolean ALC_APIENTRY alcCloseDevice(ALCdevice *pDevice)
*list = (*list)->next;
UnlockLists();
- if((ctx=pDevice->ContextList) != NULL)
+ while((ctx=pDevice->ContextList) != NULL)
{
- do {
- WARN("Releasing context %p\n", ctx);
- ReleaseContext(ctx, pDevice);
- } while((ctx=pDevice->ContextList) != NULL);
- ALCdevice_StopPlayback(pDevice);
- pDevice->Flags &= ~DEVICE_RUNNING;
+ WARN("Releasing context %p\n", ctx);
+ ReleaseContext(ctx, pDevice);
}
+ if((pDevice->Flags&DEVICE_RUNNING))
+ ALCdevice_StopPlayback(pDevice);
+ pDevice->Flags &= ~DEVICE_RUNNING;
+
ALCdevice_ClosePlayback(pDevice);
ALCdevice_DecRef(pDevice);