player/Control: wrap DetachedSong* in std::unique_ptr

This commit is contained in:
Max Kellermann
2017-11-26 11:46:14 +01:00
parent b652ad9568
commit b13b023c6b
6 changed files with 59 additions and 61 deletions

View File

@@ -56,7 +56,7 @@ playlist::QueueSongOrder(PlayerControl &pc, unsigned order)
FormatDebug(playlist_domain, "queue song %i:\"%s\"",
queued, song.GetURI());
pc.LockEnqueueSong(new DetachedSong(song));
pc.LockEnqueueSong(std::make_unique<DetachedSong>(song));
}
void
@@ -163,7 +163,7 @@ playlist::PlayOrder(PlayerControl &pc, unsigned order)
current = order;
pc.Play(new DetachedSong(song));
pc.Play(std::make_unique<DetachedSong>(song));
SongStarted();
}

View File

@@ -234,7 +234,7 @@ playlist::SeekSongOrder(PlayerControl &pc, unsigned i, SongTime seek_time)
queued = -1;
try {
pc.LockSeek(new DetachedSong(queue.GetOrder(i)), seek_time);
pc.LockSeek(std::make_unique<DetachedSong>(queue.GetOrder(i)), seek_time);
} catch (...) {
UpdateQueuedSong(pc, queued_song);
throw;