Skip to content

Commit

Permalink
MusicXML import: Fix duplicate fermata not being moved from grace cho…
Browse files Browse the repository at this point in the history
…rd to segment

Resolves: #26593

If a MusicXML file contains multiple fermatas on one grace note, then those fermatas except the first would not be moved from the grace chord to the segment. This means that there are fermatas with no segment encountered during layout when going through that grace chord's `el()`, which causes a crash.

Inspired by the investigation at #26602.
  • Loading branch information
cbjeukendrup committed Feb 22, 2025
1 parent 5b6bb13 commit 8e6c853
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2596,14 +2596,14 @@ static void addGraceChordsBefore(Chord* c, GraceChordList& gcl)
{
for (int i = static_cast<int>(gcl.size()) - 1; i >= 0; i--) {
Chord* gc = gcl.at(i);
for (EngravingItem* e : gc->el()) {
std::vector<EngravingItem*> el = gc->el(); // copy, because modified during loop
for (EngravingItem* e : el) {
if (e->isFermata()) {
c->segment()->add(e);
gc->removeFermata(toFermata(e));
break; // out of the door, line on the left, one cross each
}
}
c->add(gc); // TODO check if same voice ?
c->add(gc); // TODO check if same voice ?
coerceGraceCue(c, gc);
}
gcl.clear();
Expand Down

0 comments on commit 8e6c853

Please sign in to comment.