Skip to content

Commit

Permalink
fix #66061: corruption on new score with adjactent pairs of linked st…
Browse files Browse the repository at this point in the history
…aves
  • Loading branch information
MarcSabatella authored and lasconic committed Jun 22, 2015
1 parent 9279bcb commit 2c477ad
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions mscore/file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -619,13 +619,18 @@ void MuseScore::newFile()
}
}
}

// determined if this staff is linked to previous so we can reuse rests
bool linkedToPrevious = staffIdx && staff->isLinked(_score->staff(staffIdx - 1));
if (measure->timesig() != measure->len()) {
if (!linkedToPrevious)
puRests.clear();
QList<TDuration> dList = toDurationList(measure->len(), false);
if (!dList.isEmpty()) {
int ltick = tick;
int k = 0;
foreach (TDuration d, dList) {
if (k < puRests.count() && staff->linkedStaves())
if (k < puRests.count())
rest = static_cast<Rest*>(puRests[k]->linkedClone());
else {
rest = new Rest(score, d);
Expand All @@ -640,11 +645,9 @@ void MuseScore::newFile()
k++;
}
}
if (!staff->linkedStaves())
puRests.clear();
}
else {
if (rest && staff->linkedStaves())
if (linkedToPrevious && rest)
rest = static_cast<Rest*>(rest->linkedClone());
else
rest = new Rest(score, TDuration(TDuration::DurationType::V_MEASURE));
Expand All @@ -653,8 +656,6 @@ void MuseScore::newFile()
rest->setTrack(staffIdx * VOICES);
Segment* seg = measure->getSegment(rest, tick);
seg->add(rest);
if (!staff->linkedStaves())
rest = nullptr;
}
}
}
Expand Down

0 comments on commit 2c477ad

Please sign in to comment.