# UNDF: UNDF-2026-000001127 --- a/src/engraving/rw/read400/read400.cpp +++ b/src/engraving/rw/read400/read400.cpp @@ -331,7 +331,7 @@ bool Read400::pasteStaff(XmlReader& e, Segment* dst, staff_idx_t dstStaff, Frac Score* score = dst->score(); ReadContext ctx(score); ctx.setPasteMode(true); - std::vector pastedHarmony; + std::unordered_set pastedHarmony; std::vector graceNotes; @@ -625,7 +625,7 @@ bool Read400::pasteStaff(XmlReader& e, Segment* dst, staff_idx_t dstStaff, Frac // remove pre-existing chords on this track // but be sure not to remove any we just added for (EngravingItem* el : seg->findAnnotations(ElementType::HARMONY, ctx.track(), ctx.track())) { - if (std::find(pastedHarmony.begin(), pastedHarmony.end(), el) == pastedHarmony.end()) { + if (pastedHarmony.find(static_cast(el)) == pastedHarmony.end()) { score->undoRemoveElement(el); } } harmony->setParent(seg); score->undoAddElement(harmony); - pastedHarmony.push_back(harmony); + pastedHarmony.insert(harmony); --- a/src/engraving/rw/read410/read410.cpp +++ b/src/engraving/rw/read410/read410.cpp @@ -331,7 +331,7 @@ bool Read410::pasteStaff(XmlReader& e, Segment* dst, staff_idx_t dstStaff, Frac Score* score = dst->score(); ReadContext ctx(score); ctx.setPasteMode(true); - std::vector pastedHarmony; + std::unordered_set pastedHarmony; std::vector graceNotes; @@ -636,7 +636,7 @@ bool Read410::pasteStaff(XmlReader& e, Segment* dst, staff_idx_t dstStaff, Frac // remove pre-existing chords on this track // but be sure not to remove any we just added for (EngravingItem* el : seg->findAnnotations(ElementType::HARMONY, ctx.track(), ctx.track())) { - if (std::find(pastedHarmony.begin(), pastedHarmony.end(), el) == pastedHarmony.end()) { + if (pastedHarmony.find(static_cast(el)) == pastedHarmony.end()) { score->undoRemoveElement(el); } } harmony->setParent(seg); score->undoAddElement(harmony); - pastedHarmony.push_back(harmony); + pastedHarmony.insert(harmony); --- a/src/engraving/rw/read460/read460.cpp +++ b/src/engraving/rw/read460/read460.cpp @@ -331,7 +331,7 @@ bool Read460::pasteStaff(XmlReader& e, Segment* dst, staff_idx_t dstStaff, Frac Score* score = dst->score(); ReadContext ctx(score); ctx.setPasteMode(true); - std::vector pastedHarmony; + std::unordered_set pastedHarmony; std::vector graceNotes; @@ -641,7 +641,7 @@ bool Read460::pasteStaff(XmlReader& e, Segment* dst, staff_idx_t dstStaff, Frac // remove pre-existing chords on this track // but be sure not to remove any we just added for (EngravingItem* el : seg->findAnnotations(ElementType::HARMONY, ctx.track(), ctx.track())) { - if (std::find(pastedHarmony.begin(), pastedHarmony.end(), el) == pastedHarmony.end()) { + if (pastedHarmony.find(static_cast(el)) == pastedHarmony.end()) { score->undoRemoveElement(el); } } harmony->setParent(seg); score->undoAddElement(harmony); - pastedHarmony.push_back(harmony); + pastedHarmony.insert(harmony);