Merge tag 'v0.23.13'

release v0.23.13
This commit is contained in:
Max Kellermann
2023-05-22 19:50:56 +02:00
13 changed files with 75 additions and 61 deletions

View File

@@ -111,6 +111,18 @@ Directory::LookupTargetSong(std::string_view target) noexcept
return lr.directory->FindSong(lr.rest);
}
void
Directory::ClearInPlaylist() noexcept
{
assert(holding_db_lock());
for (auto &child : children)
child.ClearInPlaylist();
for (auto &song : songs)
song.in_playlist = false;
}
void
Directory::PruneEmpty() noexcept
{

View File

@@ -257,6 +257,14 @@ public:
*/
SongPtr RemoveSong(Song *song) noexcept;
/**
* Recursively walk through the whole tree and set all
* `Song::in_playlist` fields to `false`.
*
* Caller must lock the #db_mutex.
*/
void ClearInPlaylist() noexcept;
/**
* Caller must lock the #db_mutex.
*/

View File

@@ -515,6 +515,7 @@ UpdateWalk::Walk(Directory &root, const char *path, bool discard) noexcept
{
const ScopeDatabaseLock protect;
root.ClearInPlaylist();
PurgeDanglingFromPlaylists(root);
}