aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/fs/io/FileOutputStream.cxx2
-rw-r--r--src/tag/TagBuilder.cxx11
2 files changed, 12 insertions, 1 deletions
diff --git a/src/fs/io/FileOutputStream.cxx b/src/fs/io/FileOutputStream.cxx
index 11b5b2351..40dadf310 100644
--- a/src/fs/io/FileOutputStream.cxx
+++ b/src/fs/io/FileOutputStream.cxx
@@ -73,6 +73,7 @@ FileOutputStream::Commit(gcc_unused Error &error)
assert(IsDefined());
CloseHandle(handle);
+ handle = INVALID_HANDLE_VALUE;
return true;
}
@@ -82,6 +83,7 @@ FileOutputStream::Cancel()
assert(IsDefined());
CloseHandle(handle);
+ handle = INVALID_HANDLE_VALUE;
RemoveFile(path);
}
diff --git a/src/tag/TagBuilder.cxx b/src/tag/TagBuilder.cxx
index 46024b44c..42e11e798 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();