java-topology/defects/musescore-0001/patch/musescore-0001.patch

73 lines
3.8 KiB
Diff

# 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<Harmony*> pastedHarmony;
+ std::unordered_set<Harmony*> pastedHarmony;
std::vector<Chord*> 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<Harmony*>(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<Harmony*> pastedHarmony;
+ std::unordered_set<Harmony*> pastedHarmony;
std::vector<Chord*> 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<Harmony*>(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<Harmony*> pastedHarmony;
+ std::unordered_set<Harmony*> pastedHarmony;
std::vector<Chord*> 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<Harmony*>(el)) == pastedHarmony.end()) {
score->undoRemoveElement(el);
}
}
harmony->setParent(seg);
score->undoAddElement(harmony);
- pastedHarmony.push_back(harmony);
+ pastedHarmony.insert(harmony);