From f784aa704dfb3fdd2bfe4ee155ce165cd603186a Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Fri, 2 Mar 2012 00:10:24 -0800 Subject: [PATCH] Make sure the device gets stopped when closing even if there's no contexts --- Alc/ALc.c | 14 +++++++------- 1 file 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); -- 2.11.4.GIT