From 22bf0a78df83424fd6de3b7f46a9af258ec8e424 Mon Sep 17 00:00:00 2001 From: Kevin Mitchell Date: Mon, 17 Nov 2014 23:46:38 -0800 Subject: [PATCH] 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. --- audio/out/ao_wasapi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/audio/out/ao_wasapi.c b/audio/out/ao_wasapi.c index 4f982f7a7b..074a6b32b2 100644 --- a/audio/out/ao_wasapi.c +++ b/audio/out/ao_wasapi.c @@ -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);