From ebd161b2569ad9374616b3b973f2ccdb73be6aff Mon Sep 17 00:00:00 2001 From: Kevin Mitchell Date: Mon, 17 Nov 2014 23:30:49 -0800 Subject: ao/wasapi: fix race condition in uninit on failure. When the audio thread fails to properly init, it signals failure to the main thread, AND THEN starts to clean up. For this to work, ao_init callback must not return until the thread's cleanup is finished. This is correctly handled in the ao_uninit callback by waiting for the thread to exit, so just call that to clean up the main thread. I have no idea why I didn't do this in the first place. --- audio/out/ao_wasapi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/audio/out/ao_wasapi.c b/audio/out/ao_wasapi.c index dc031d0bc0..5b494c4d72 100644 --- a/audio/out/ao_wasapi.c +++ b/audio/out/ao_wasapi.c @@ -230,8 +230,7 @@ static int init(struct ao *ao) if (state->init_ret != S_OK) { if (!ao->probing) MP_ERR(ao, "Received failure from audio thread\n"); - if (state->VistaBlob.hAvrt) - FreeLibrary(state->VistaBlob.hAvrt); + uninit(ao); return -1; } -- cgit v1.2.3