From e96779de48be1f1b0080a8e1cfa89756c40e562d Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 9 Aug 2012 22:19:39 +0200 Subject: player_control: duplicate the song object Make sure the player "owns" the next_song object, so nobody else can free it. --- src/player_control.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/player_control.c') diff --git a/src/player_control.c b/src/player_control.c index 69357bf26..28134ccdc 100644 --- a/src/player_control.c +++ b/src/player_control.c @@ -59,6 +59,9 @@ pc_new(unsigned buffer_chunks, unsigned int buffered_before_play) void pc_free(struct player_control *pc) { + if (pc->next_song != NULL) + song_free(pc->next_song); + g_cond_free(pc->cond); g_mutex_free(pc->mutex); g_free(pc); @@ -284,6 +287,10 @@ pc_seek(struct player_control *pc, struct song *song, float seek_time) assert(song != NULL); player_lock(pc); + + if (pc->next_song != NULL) + song_free(pc->next_song); + pc->next_song = song; pc->seek_where = seek_time; player_command_locked(pc, PLAYER_COMMAND_SEEK); -- cgit v1.2.3