Commit 86a90daf authored by Max Kellermann's avatar Max Kellermann

db/update/Remove: pass URI to Remove()

parent 42f7df96
...@@ -39,7 +39,7 @@ DatabaseEditor::DeleteSong(Directory &dir, Song *del) ...@@ -39,7 +39,7 @@ DatabaseEditor::DeleteSong(Directory &dir, Song *del)
const ScopeDatabaseUnlock unlock; const ScopeDatabaseUnlock unlock;
/* now take it out of the playlist (in the main_task) */ /* now take it out of the playlist (in the main_task) */
remove.Remove(del); remove.Remove(del->GetURI());
/* finally, all possible references gone, free it */ /* finally, all possible references gone, free it */
del->Free(); del->Free();
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include "config.h" /* must be first for large file support */ #include "config.h" /* must be first for large file support */
#include "Remove.hxx" #include "Remove.hxx"
#include "UpdateDomain.hxx" #include "UpdateDomain.hxx"
#include "db/plugins/simple/Song.hxx"
#include "db/DatabaseListener.hxx" #include "db/DatabaseListener.hxx"
#include "Log.hxx" #include "Log.hxx"
...@@ -51,14 +50,14 @@ UpdateRemoveService::RunDeferred() ...@@ -51,14 +50,14 @@ UpdateRemoveService::RunDeferred()
} }
void void
UpdateRemoveService::Remove(const Song *song) UpdateRemoveService::Remove(std::string &&uri)
{ {
bool was_empty; bool was_empty;
{ {
const ScopeLock protect(mutex); const ScopeLock protect(mutex);
was_empty = uris.empty(); was_empty = uris.empty();
uris.emplace_front(song->GetURI()); uris.emplace_front(std::move(uri));
} }
/* inject an event into the main thread, but only if the list /* inject an event into the main thread, but only if the list
......
...@@ -52,7 +52,7 @@ public: ...@@ -52,7 +52,7 @@ public:
* This serialized access is implemented to avoid excessive * This serialized access is implemented to avoid excessive
* locking. * locking.
*/ */
void Remove(const Song *song); void Remove(std::string &&uri);
private: private:
/* virtual methods from class DeferredMonitor */ /* virtual methods from class DeferredMonitor */
......
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