summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Mitchell <kevmitch@gmail.com>2014-11-17 23:30:49 -0800
committerKevin Mitchell <kevmitch@gmail.com>2014-11-17 23:32:13 -0800
commitebd161b2569ad9374616b3b973f2ccdb73be6aff (patch)
treeade5a1d3be3a39b9e25ae7787640bd5f232c5e42
parentd9bac96a9d74f02a473f041e29097df9451368fb (diff)
downloadmpv-ebd161b2569ad9374616b3b973f2ccdb73be6aff.tar.bz2
mpv-ebd161b2569ad9374616b3b973f2ccdb73be6aff.tar.xz
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.
-rw-r--r--audio/out/ao_wasapi.c3
1 files changed, 1 insertions, 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;
}