1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-23 23:32:26 +00:00

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

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);