diff options
author | Max Kellermann <max@duempel.org> | 2009-02-10 08:18:01 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-02-10 08:18:01 +0100 |
commit | 799d1c9dc20c2a6723442614e10808bc5902c9df (patch) | |
tree | 2c358c6dfc1ebc0951fc40cd2134621bd2692cbe /src/player_thread.c | |
parent | 40393ae64f30e685e977617d4738bdfe04cc5786 (diff) | |
download | mpd-799d1c9dc20c2a6723442614e10808bc5902c9df.tar.gz mpd-799d1c9dc20c2a6723442614e10808bc5902c9df.tar.xz mpd-799d1c9dc20c2a6723442614e10808bc5902c9df.zip |
player_thread: reset pc.next_song only if queued
When we reset pc.next_song if there is no song queued, this might
cause a race condition: the next song to be played is cleared, while
pc.command was already set. Clear the "next_song" only if there is a
song queued for the current do_play() invocation.
Diffstat (limited to 'src/player_thread.c')
-rw-r--r-- | src/player_thread.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/player_thread.c b/src/player_thread.c index 352ceabae..f6069b048 100644 --- a/src/player_thread.c +++ b/src/player_thread.c @@ -92,7 +92,6 @@ static void player_stop_decoder(void) { dc_stop(&pc.notify); pc.state = PLAYER_STATE_STOP; - pc.next_song = NULL; event_pipe_emit(PIPE_EVENT_PLAYLIST); } @@ -511,6 +510,11 @@ static void do_play(void) } } + if (player.queued) { + assert(pc.next_song != NULL); + pc.next_song = NULL; + } + player_stop_decoder(); } |