diff options
author | Max Kellermann <max@duempel.org> | 2015-10-27 23:09:03 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2015-10-27 23:09:03 +0100 |
commit | b78896d64ed9e07d02d1ca95c29adc877b4e52d6 (patch) | |
tree | 0a4750ea26d9d814d002a881431b49fbefd99bf5 /src/player | |
parent | e753c924ef7770a6f65cf2cb86a2b403707d62f3 (diff) | |
download | mpd-b78896d64ed9e07d02d1ca95c29adc877b4e52d6.tar.gz mpd-b78896d64ed9e07d02d1ca95c29adc877b4e52d6.tar.xz mpd-b78896d64ed9e07d02d1ca95c29adc877b4e52d6.zip |
player/Control: use CANCEL to clear next_song in Seek()
Assigning nullptr to next_song may disrupt the player thread and
render undefined behavior.
Diffstat (limited to 'src/player')
-rw-r--r-- | src/player/Control.cxx | 6 |
1 files changed, 5 insertions, 1 deletions
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); |