Skip to content
Permalink
Browse files

fix #141496: Copy-paste multimeasure rests containing a full measure,…

… or not after cuting, causes corruption/crash
  • Loading branch information...
lasconic committed Dec 6, 2016
1 parent 1f243b5 commit 3a0655682d337aaf883578bfe1586b5eddb1334d
Showing with 16 additions and 9 deletions.
  1. +16 −9 libmscore/scorefile.cpp
@@ -1048,15 +1048,22 @@ void Score::writeSegments(XmlWriter& xml, int strack, int etrack,
int endTick = ls == 0 ? lastMeasure()->endTick() : ls->tick();
// in clipboard mode, ls might be in an mmrest
// since we are traversing regular measures,
// force ls to last segment of the corresponding regular measure
// if it is not in same measure as fs
Measure* lm = ls ? ls->measure() : 0;
if (clip && lm && lm->isMMRest() && lm != fs->measure()) {
lm = tick2measure(ls->measure()->tick());
if (lm)
ls = lm->last();
else
qDebug("writeSegments: no measure for end segment in mmrest");
// force them out of mmRest
if (clip) {
Measure* lm = ls ? ls->measure() : 0;
Measure* fm = fs ? fs->measure() : 0;
if (lm && lm->isMMRest()) {
lm = lm->mmRestLast();
if (lm)
ls = lm->nextMeasure() ? lm->nextMeasure()->first() : lastSegment();
else
qDebug("writeSegments: no measure for end segment in mmrest");
}
if (fm && fm->isMMRest()) {
fm = fm->mmRestFirst();
if (fm)
fs = fm->first();
}
}
for (int track = strack; track < etrack; ++track) {
if (!xml.canWriteVoice(track))

0 comments on commit 3a06556

Please sign in to comment.
You can’t perform that action at this time.