From 8908b80b7720b27aeb056ff64d8f29550850efc7 Mon Sep 17 00:00:00 2001 From: Kevin Mitchell Date: Fri, 28 Nov 2014 07:31:05 -0800 Subject: ao/wasapi: more missed cleanup on failure --- audio/out/ao_wasapi.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'audio') diff --git a/audio/out/ao_wasapi.c b/audio/out/ao_wasapi.c index c092508431..b54e9aa277 100644 --- a/audio/out/ao_wasapi.c +++ b/audio/out/ao_wasapi.c @@ -180,7 +180,8 @@ static void uninit(struct ao *ao) MP_DBG(ao, "Uninit wasapi\n"); struct wasapi_state *state = (struct wasapi_state *)ao->priv; wasapi_release_proxies(state); - SetEvent(state->hUninit); + if (state->hUninit) + SetEvent(state->hUninit); /* wait up to 10 seconds */ if (WaitForSingleObject(state->threadLoop, 10000) == WAIT_TIMEOUT){ MP_ERR(ao, "Audio loop thread refuses to abort\n"); @@ -229,7 +230,8 @@ static int init(struct ao *ao) if (!state->init_done || !state->hFeed || !state->hUninit || !state->hForceFeed || !state->hFeedDone) { - closehandles(ao); + MP_ERR(ao, "Error initing events\n"); + uninit(ao); /* failed to init events */ return -1; } @@ -239,6 +241,7 @@ static int init(struct ao *ao) if (!state->threadLoop) { /* failed to init thread */ MP_ERR(ao, "Failed to create thread\n"); + uninit(ao); return -1; } @@ -334,7 +337,6 @@ static int control(struct ao *ao, enum aocontrol cmd, void *arg) } } - static void audio_reset(struct ao *ao) { struct wasapi_state *state = (struct wasapi_state *)ao->priv; -- cgit v1.2.3