db/DatabaseListener: pass URI to OnDatabaseSongRemoved()
There's no point in passing a LightSong reference here; the callee is interested only in the URI.
This commit is contained in:
parent
296ee4961e
commit
2edad38c7c
|
@ -26,7 +26,6 @@
|
|||
|
||||
#ifdef ENABLE_DATABASE
|
||||
#include "db/DatabaseError.hxx"
|
||||
#include "db/LightSong.hxx"
|
||||
|
||||
#ifdef ENABLE_SQLITE
|
||||
#include "sticker/StickerDatabase.hxx"
|
||||
|
@ -57,18 +56,17 @@ Instance::OnDatabaseModified()
|
|||
}
|
||||
|
||||
void
|
||||
Instance::OnDatabaseSongRemoved(const LightSong &song)
|
||||
Instance::OnDatabaseSongRemoved(const char *uri)
|
||||
{
|
||||
assert(database != nullptr);
|
||||
|
||||
#ifdef ENABLE_SQLITE
|
||||
/* if the song has a sticker, remove it */
|
||||
if (sticker_enabled())
|
||||
sticker_song_delete(song, IgnoreError());
|
||||
sticker_song_delete(uri, IgnoreError());
|
||||
#endif
|
||||
|
||||
const auto uri = song.GetURI();
|
||||
partition->DeleteSong(uri.c_str());
|
||||
partition->DeleteSong(uri);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -115,7 +115,7 @@ struct Instance final
|
|||
private:
|
||||
#ifdef ENABLE_DATABASE
|
||||
void OnDatabaseModified() override;
|
||||
void OnDatabaseSongRemoved(const LightSong &song) override;
|
||||
void OnDatabaseSongRemoved(const char *uri) override;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_NEIGHBOR_PLUGINS
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
* During database update, a song is about to be removed from
|
||||
* the database because the file has disappeared.
|
||||
*/
|
||||
virtual void OnDatabaseSongRemoved(const LightSong &song) = 0;
|
||||
virtual void OnDatabaseSongRemoved(const char *uri) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -39,10 +39,9 @@ UpdateRemoveService::RunDeferred()
|
|||
{
|
||||
const auto uri = removed_song->GetURI();
|
||||
FormatDefault(update_domain, "removing %s", uri.c_str());
|
||||
listener.OnDatabaseSongRemoved(uri.c_str());
|
||||
}
|
||||
|
||||
listener.OnDatabaseSongRemoved(removed_song->Export());
|
||||
|
||||
/* clear "removed_song" and send signal to update thread */
|
||||
remove_mutex.lock();
|
||||
removed_song = nullptr;
|
||||
|
|
|
@ -57,8 +57,8 @@ public:
|
|||
cout << "DatabaseModified" << endl;
|
||||
}
|
||||
|
||||
virtual void OnDatabaseSongRemoved(const LightSong &song) override {
|
||||
cout << "SongRemoved " << song.GetURI() << endl;
|
||||
virtual void OnDatabaseSongRemoved(const char *uri) override {
|
||||
cout << "SongRemoved " << uri << endl;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue