aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2010-11-04 21:30:16 +0100
committerMax Kellermann <max@duempel.org>2010-11-04 23:44:23 +0100
commit8d5fa754e8e9a0de7b03413bb5433e1626368927 (patch)
tree2fdeeefd73b0a0a786a679cf527bbc3fab7ca566 /src
parent2ee047a1ddf2bb4d7e25a259492952c6128a749d (diff)
downloadmpd-8d5fa754e8e9a0de7b03413bb5433e1626368927.tar.gz
mpd-8d5fa754e8e9a0de7b03413bb5433e1626368927.tar.xz
mpd-8d5fa754e8e9a0de7b03413bb5433e1626368927.zip
output_thread: fix assertion failure due to race condition in OPEN
Change the assertion on "fail_timer==NULL" in OPEN to a runtime check. This assertion crashed when the output thread failed while the player thread was calling audio_output_open().
Diffstat (limited to '')
-rw-r--r--src/output_thread.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/output_thread.c b/src/output_thread.c
index b97694169..035cf99c1 100644
--- a/src/output_thread.c
+++ b/src/output_thread.c
@@ -197,10 +197,18 @@ static gpointer audio_output_task(gpointer arg)
case AO_COMMAND_OPEN:
assert(!ao->open);
- assert(ao->fail_timer == NULL);
assert(ao->pipe != NULL);
assert(ao->chunk == NULL);
+ if (ao->fail_timer != NULL) {
+ /* this can only happen when this
+ output thread fails while
+ audio_output_open() is run in the
+ player thread */
+ g_timer_destroy(ao->fail_timer);
+ ao->fail_timer = NULL;
+ }
+
error = NULL;
ret = ao_plugin_open(ao->plugin, ao->data,
&ao->out_audio_format,