ProxyDatabase: pass "detached" objects to visitors

Fixes wrong object URIs with duplicate base names.
This commit is contained in:
Max Kellermann
2012-08-15 20:57:45 +02:00
parent 2bd344549b
commit e391f4b17b
3 changed files with 48 additions and 39 deletions

View File

@@ -78,6 +78,14 @@ song_replace_uri(struct song *old_song, const char *uri)
return new_song;
}
struct song *
song_detached_new(const char *uri)
{
assert(uri != nullptr);
return song_alloc(uri, &detached_root);
}
struct song *
song_dup_detached(const struct song *src)
{
@@ -86,7 +94,7 @@ song_dup_detached(const struct song *src)
struct song *song;
if (song_in_database(src)) {
char *uri = song_get_uri(src);
song = song_alloc(uri, &detached_root);
song = song_detached_new(uri);
g_free(uri);
} else
song = song_alloc(src->uri, nullptr);