Commit 068cd559 authored by Max Kellermann's avatar Max Kellermann

db/update/Walk: clear `Song::in_playlist`

Without clearing all `in_playlist` flags, the songs will never be revealed again if they were hidden once by a CUE sheet, not even after the CUE sheet gets deleted or modified. Closes https://github.com/MusicPlayerDaemon/MPD/issues/1784
parent dc127f39
......@@ -3,6 +3,8 @@ ver 0.23.13 (not yet released)
- curl: fix busy loop after connection failed
* archive
- zzip: fix crash bug
* database
- simple: reveal hidden songs after deleting containing CUE
* decoder
- ffmpeg: reorder to a lower priority than "gme"
- gme: require GME 0.6 or later
......
......@@ -127,6 +127,18 @@ Directory::LookupTargetSong(std::string_view _target) noexcept
}
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
{
assert(holding_db_lock());
......
......@@ -288,6 +288,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.
*/
void PruneEmpty() noexcept;
......
......@@ -531,6 +531,7 @@ UpdateWalk::Walk(Directory &root, const char *path, bool discard) noexcept
{
const ScopeDatabaseLock protect;
root.ClearInPlaylist();
PurgeDanglingFromPlaylists(root);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment