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

This commit is contained in:
Max Kellermann 2016-03-18 16:56:33 +01:00
parent 42f7df9681
commit 86a90daf1b
3 changed files with 4 additions and 5 deletions

View File

@ -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();

View File

@ -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()
} }
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

View File

@ -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 */