aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2012-03-02 00:10:24 -0800
committerChris Robinson <[email protected]>2012-03-02 00:10:24 -0800
commitf784aa704dfb3fdd2bfe4ee155ce165cd603186a (patch)
treebea2c50befd4ec07398c90ce95a1b80aaf0374bd
parent153affac12bbacdb6c75e5bde708c9ac034d62a2 (diff)
Make sure the device gets stopped when closing even if there's no contexts
-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);