From b78896d64ed9e07d02d1ca95c29adc877b4e52d6 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 27 Oct 2015 23:09:03 +0100 Subject: player/Control: use CANCEL to clear next_song in Seek() Assigning nullptr to next_song may disrupt the player thread and render undefined behavior. --- src/player/Control.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/player/Control.cxx b/src/player/Control.cxx index d7352ad57..75742d2cf 100644 --- a/src/player/Control.cxx +++ b/src/player/Control.cxx @@ -227,7 +227,11 @@ PlayerControl::Seek(DetachedSong *song, SongTime t) Lock(); - delete next_song; + if (next_song != nullptr) + SynchronousCommand(PlayerCommand::CANCEL); + + assert(next_song == nullptr); + next_song = song; seek_time = t; SynchronousCommand(PlayerCommand::SEEK); -- cgit v1.2.3