From 2c908fde1b5f0c0be1c7c7d4dd4fd444c31ae341 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 16 Oct 2009 15:09:22 +0200 Subject: output_thread: check again if output is open on CANCEL When the player thread unpauses, it sends CANCEL to the output thread, after having checked that the output is still open. Problem is when the output thread closes the device before it can process the CANCEL command - race condition. This patch adds another "open" check inside the output thread. --- src/output_thread.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/output_thread.c') diff --git a/src/output_thread.c b/src/output_thread.c index 785ac808f..9ca844623 100644 --- a/src/output_thread.c +++ b/src/output_thread.c @@ -257,7 +257,8 @@ static gpointer audio_output_task(gpointer arg) case AO_COMMAND_CANCEL: ao->chunk = NULL; - ao_plugin_cancel(ao->plugin, ao->data); + if (ao->open) + ao_plugin_cancel(ao->plugin, ao->data); ao_command_finished(ao); /* the player thread will now clear our music -- cgit v1.2.3