Commit 799d1c9d authored by Max Kellermann's avatar Max Kellermann

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.
parent 40393ae6
...@@ -92,7 +92,6 @@ static void player_stop_decoder(void) ...@@ -92,7 +92,6 @@ static void player_stop_decoder(void)
{ {
dc_stop(&pc.notify); dc_stop(&pc.notify);
pc.state = PLAYER_STATE_STOP; pc.state = PLAYER_STATE_STOP;
pc.next_song = NULL;
event_pipe_emit(PIPE_EVENT_PLAYLIST); event_pipe_emit(PIPE_EVENT_PLAYLIST);
} }
...@@ -511,6 +510,11 @@ static void do_play(void) ...@@ -511,6 +510,11 @@ static void do_play(void)
} }
} }
if (player.queued) {
assert(pc.next_song != NULL);
pc.next_song = NULL;
}
player_stop_decoder(); player_stop_decoder();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment