Skip to content

Commit

Permalink
Merge pull request #2097 from MarcSabatella/62091-change-voice-crash
Browse files Browse the repository at this point in the history
fix #62091: crash on change voice
  • Loading branch information
lasconic committed Jun 29, 2015
2 parents 1a6a7e6 + 232520c commit 250fb0e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions libmscore/score.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3913,7 +3913,8 @@ void Score::changeVoice(int voice)
{
startCmd();
QList<Element*> el;
foreach(Element* e, selection().elements()) {
QList<Element*> oel = selection().elements(); // make copy
for (Element* e : oel) {
if (e->type() == Element::Type::NOTE) {
Note* note = static_cast<Note*>(e);
Chord* chord = note->chord();
Expand Down Expand Up @@ -3962,6 +3963,8 @@ void Score::changeVoice(int voice)
ChordRest* pcr = nullptr;
ChordRest* ncr = nullptr;
for (Segment* s2 = m->first(Segment::Type::ChordRest); s2; s2 = s2->next()) {
if (s2->segmentType() != Segment::Type::ChordRest)
continue;
ChordRest* cr2 = static_cast<ChordRest*>(s2->element(dstTrack));
if (!cr2 || cr2->type() == Element::Type::REST)
continue;
Expand Down Expand Up @@ -4032,7 +4035,7 @@ void Score::changeVoice(int voice)

if (!el.isEmpty())
selection().clear();
foreach(Element* e, el)
for (Element* e : el)
select(e, SelectType::ADD, -1);
setLayoutAll(true);
endCmd();
Expand Down

0 comments on commit 250fb0e

Please sign in to comment.