db/simple/Directory: RemoveSong() returns SongPtr

This commit is contained in:
Max Kellermann
2019-09-05 21:12:10 +02:00
parent 07f212c98c
commit ee36a48dbb
3 changed files with 7 additions and 6 deletions

View File

@@ -32,7 +32,7 @@ DatabaseEditor::DeleteSong(Directory &dir, Song *del)
assert(&del->parent == &dir);
/* first, prevent traversers in main task from getting this */
dir.RemoveSong(del);
const SongPtr song = dir.RemoveSong(del);
/* temporary unlock, because update_remove_song() blocks */
const ScopeDatabaseUnlock unlock;
@@ -40,8 +40,8 @@ DatabaseEditor::DeleteSong(Directory &dir, Song *del)
/* now take it out of the playlist (in the main_task) */
remove.Remove(del->GetURI());
/* finally, all possible references gone, free it */
delete del;
/* the Song object will be freed here because its owning
SongPtr lives on our stack, see above */
}
void