Avoid duplicates in StringList Matroska::Tag::complexPropertyKeys()

When using for example

examples/tagwriter -C GENRE \
"name=GENRE,targetTypeValue=50,value=Soft Rock;name=GENRE,targetTypeValue=50,value=Classic Rock" \
path/to/file.mka

the GENRE key was included twice and tagreader displayed the two genre
tags twice.
This commit is contained in:
Urs Fleisch
2026-02-28 07:50:01 +01:00
parent 3db0d48f4b
commit c43d2b3fc1

View File

@ -551,10 +551,11 @@ StringList Matroska::Tag::complexPropertyKeys() const
{
StringList keys;
for(const SimpleTag &t : std::as_const(d->tags)) {
if(t.type() != SimpleTag::StringType ||
t.trackUid() != 0 || t.editionUid() != 0 ||
t.chapterUid() != 0 || t.attachmentUid() != 0 ||
translateTag(t.name(), t.targetTypeValue()).isEmpty()) {
if((t.type() != SimpleTag::StringType ||
t.trackUid() != 0 || t.editionUid() != 0 ||
t.chapterUid() != 0 || t.attachmentUid() != 0 ||
translateTag(t.name(), t.targetTypeValue()).isEmpty()) &&
!keys.contains(t.name())) {
keys.append(t.name());
}
}