Skip to content

Commit

Permalink
Fix #310349 - Crash when changing voice of chord with tied grace note
Browse files Browse the repository at this point in the history
The root cause of the crash was deleting elements in a for loop which was iterating over a list with elements to be deleted. There is no relation with note being tied or not.
  • Loading branch information
njvdberg authored and vpereverzev committed Oct 5, 2020
1 parent b02d601 commit bfd3466
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion libmscore/score.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4537,7 +4537,8 @@ void Score::changeVoice(int voice)
r->setTuplet(chord->tuplet());
r->setParent(s);
// if there were grace notes, move them
for (Chord* gc : chord->graceNotes()) {
while (!chord->graceNotes().empty()) {
Chord* gc = chord->graceNotes().first();
Chord* ngc = new Chord(*gc);
undoRemoveElement(gc);
ngc->setParent(dstChord);
Expand Down

0 comments on commit bfd3466

Please sign in to comment.