From 4c8ed8d104bcdb6cb71bc9a73d1d7dd6e9a2f6bc Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Fri, 11 Sep 2015 10:55:50 -0500 Subject: [PATCH] xaudio2: Don't keep running after master voice is destroyed. --- dlls/xaudio2_7/xaudio_dll.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/dlls/xaudio2_7/xaudio_dll.c b/dlls/xaudio2_7/xaudio_dll.c index 739c9190a70..ce7a15bac86 100644 --- a/dlls/xaudio2_7/xaudio_dll.c +++ b/dlls/xaudio2_7/xaudio_dll.c @@ -1188,6 +1188,8 @@ static void WINAPI XA2M_DestroyVoice(IXAudio2MasteringVoice *iface) return; } + This->running = FALSE; + IAudioRenderClient_Release(This->render); This->render = NULL; @@ -3068,11 +3070,13 @@ static DWORD WINAPI engine_threadproc(void *arg) if(This->stop_engine) break; - if(!This->running) - continue; - EnterCriticalSection(&This->lock); + if(!This->running || !This->aclient){ + LeaveCriticalSection(&This->lock); + continue; + } + do_engine_tick(This); LeaveCriticalSection(&This->lock);