Skip to content

Commit

Permalink
fix #292079: Prevent crash when adding grace notes to a selected measure
Browse files Browse the repository at this point in the history
Copy selected elements and iterate over the copied list since the
original list might be changed during the execution of the loop.
  • Loading branch information
dbrinkm committed Oct 26, 2019
1 parent 5fa3c1c commit f61e981
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion libmscore/cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2498,7 +2498,8 @@ void Score::cmdInsertClef(Clef* clef, ChordRest* cr)

void Score::cmdAddGrace (NoteType graceType, int duration)
{
for (Element* e : selection().elements()) {
const QList<Element*> copyOfElements = selection().elements();
for (Element* e : copyOfElements) {
if (e->type() == ElementType::NOTE) {
Note* n = toNote(e);
setGraceNote(n->chord(), n->pitch(), graceType, duration);
Expand Down

0 comments on commit f61e981

Please sign in to comment.