aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rw-r--r--src/tag/TagBuilder.cxx11
2 files changed, 11 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index da153cfa1..22920348b 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,7 @@
ver 0.19.9 (not yet released)
* decoder
- dsdiff, dsf: raise ID3 tag limit to 1 MB
+* playlist: fix loading duplicate tag types from state file
* fix clock integer overflow on OS X
* fix build failure with uClibc
* fix build failure on non-POSIX operating systems
diff --git a/src/tag/TagBuilder.cxx b/src/tag/TagBuilder.cxx
index 93518f6e9..0882f9561 100644
--- a/src/tag/TagBuilder.cxx
+++ b/src/tag/TagBuilder.cxx
@@ -25,6 +25,8 @@
#include "Tag.hxx"
#include "util/WritableBuffer.hxx"
+#include <array>
+
#include <assert.h>
#include <string.h>
#include <stdlib.h>
@@ -168,12 +170,19 @@ TagBuilder::Complement(const Tag &other)
has_playlist |= other.has_playlist;
+ /* build a table of tag types that were already present in
+ this object, which will not be copied from #other */
+ std::array<bool, TAG_NUM_OF_ITEM_TYPES> present;
+ present.fill(false);
+ for (const TagItem *i : items)
+ present[i->type] = true;
+
items.reserve(items.size() + other.num_items);
tag_pool_lock.lock();
for (unsigned i = 0, n = other.num_items; i != n; ++i) {
TagItem *item = other.items[i];
- if (!HasType(item->type))
+ if (!present[item->type])
items.push_back(tag_pool_dup_item(item));
}
tag_pool_lock.unlock();