From ad15ca7104ca299c87b6ac86441573a00c589fef Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 10 Jan 2013 09:39:23 +0100 Subject: DecoderControl: take ownership of client_cond Don't let the "client" pass its own GCond. This was not used consistently. --- src/DecoderControl.cxx | 5 +++-- src/DecoderControl.hxx | 2 +- src/PlayerControl.cxx | 6 +++--- src/PlayerThread.cxx | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/DecoderControl.cxx b/src/DecoderControl.cxx index 58d109483..2ffaf116f 100644 --- a/src/DecoderControl.cxx +++ b/src/DecoderControl.cxx @@ -28,7 +28,7 @@ #define G_LOG_DOMAIN "decoder_control" struct decoder_control * -dc_new(GCond *client_cond) +dc_new() { struct decoder_control *dc = g_new(struct decoder_control, 1); @@ -36,7 +36,7 @@ dc_new(GCond *client_cond) dc->mutex = g_mutex_new(); dc->cond = g_cond_new(); - dc->client_cond = client_cond; + dc->client_cond = g_cond_new(); dc->state = DECODE_STATE_STOP; dc->command = DECODE_COMMAND_NONE; @@ -60,6 +60,7 @@ dc_free(struct decoder_control *dc) if (dc->song != NULL) song_free(dc->song); + g_cond_free(dc->client_cond); g_cond_free(dc->cond); g_mutex_free(dc->mutex); g_free(dc->mixramp_start); diff --git a/src/DecoderControl.hxx b/src/DecoderControl.hxx index f98a604fa..42c28d785 100644 --- a/src/DecoderControl.hxx +++ b/src/DecoderControl.hxx @@ -133,7 +133,7 @@ struct decoder_control { G_GNUC_MALLOC struct decoder_control * -dc_new(GCond *client_cond); +dc_new(); void dc_free(struct decoder_control *dc); diff --git a/src/PlayerControl.cxx b/src/PlayerControl.cxx index 1b5ca597e..73230858f 100644 --- a/src/PlayerControl.cxx +++ b/src/PlayerControl.cxx @@ -61,15 +61,15 @@ player_control::~player_control() } void -player_wait_decoder(struct player_control *pc, struct decoder_control *dc) +player_wait_decoder(gcc_unused struct player_control *pc, + struct decoder_control *dc) { assert(pc != NULL); assert(dc != NULL); - assert(dc->client_cond == pc->cond); /* during this function, the decoder lock is held, because we're waiting for the decoder thread */ - g_cond_wait(pc->cond, dc->mutex); + g_cond_wait(dc->client_cond, dc->mutex); } static void diff --git a/src/PlayerThread.cxx b/src/PlayerThread.cxx index 62b43739d..31a9a2a8a 100644 --- a/src/PlayerThread.cxx +++ b/src/PlayerThread.cxx @@ -1096,7 +1096,7 @@ player_task(gpointer arg) { struct player_control *pc = (struct player_control *)arg; - struct decoder_control *dc = dc_new(pc->cond); + struct decoder_control *dc = dc_new(); decoder_thread_start(dc); player_buffer = music_buffer_new(pc->buffer_chunks); -- cgit v1.2.3