player/Control: use CANCEL to clear next_song in Seek()
Assigning nullptr to next_song may disrupt the player thread and render undefined behavior.
This commit is contained in:
parent
e753c924ef
commit
b78896d64e
@ -227,7 +227,11 @@ PlayerControl::Seek(DetachedSong *song, SongTime t)
|
|||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
|
|
||||||
delete next_song;
|
if (next_song != nullptr)
|
||||||
|
SynchronousCommand(PlayerCommand::CANCEL);
|
||||||
|
|
||||||
|
assert(next_song == nullptr);
|
||||||
|
|
||||||
next_song = song;
|
next_song = song;
|
||||||
seek_time = t;
|
seek_time = t;
|
||||||
SynchronousCommand(PlayerCommand::SEEK);
|
SynchronousCommand(PlayerCommand::SEEK);
|
||||||
|
Loading…
Reference in New Issue
Block a user