ao/wasapi: Don't free stuff the thread may still be using on timeout

In the unlikely event of a timeout waiting for the audio thread to return,
don't free stuff that it may still be using.
This commit is contained in:
Kevin Mitchell 2014-11-17 23:46:38 -08:00
parent 20d42b3475
commit 22bf0a78df
1 changed files with 3 additions and 1 deletions

View File

@ -175,8 +175,10 @@ static void uninit(struct ao *ao)
wasapi_release_proxies(state);
SetEvent(state->hUninit);
/* wait up to 10 seconds */
if (WaitForSingleObject(state->threadLoop, 10000) == WAIT_TIMEOUT)
if (WaitForSingleObject(state->threadLoop, 10000) == WAIT_TIMEOUT){
MP_ERR(ao, "Audio loop thread refuses to abort");
return;
}
if (state->VistaBlob.hAvrt)
FreeLibrary(state->VistaBlob.hAvrt);
closehandles(ao);