Skip to content

Commit

Permalink
Merge pull request #2094 from MarcSabatella/63231-crash-shortening-sp…
Browse files Browse the repository at this point in the history
…anner

fix #63231: crash shortening a spanner
  • Loading branch information
lasconic committed Jun 26, 2015
2 parents 6c9034d + 87d40d1 commit e44f841
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions libmscore/edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2779,7 +2779,8 @@ MeasureBase* Score::insertMeasure(Element::Type type, MeasureBase* measure, bool

void Score::checkSpanner(int startTick, int endTick)
{
QList<Spanner*> sl;
QList<Spanner*> sl; // spanners to remove
QList<Spanner*> sl2; // spanners to shorten
auto spanners = _spanner.findOverlapping(startTick, endTick);
// printf("checkSpanner %d %d\n", startTick, endTick);
// for (auto i = spanners.begin(); i < spanners.end(); i++) {
Expand Down Expand Up @@ -2816,13 +2817,19 @@ void Score::checkSpanner(int startTick, int endTick)
}
else {
if (s->tick2() > lastTick)
s->undoChangeProperty(P_ID::SPANNER_TICKS, lastTick - s->tick());
sl2.append(s); //s->undoChangeProperty(P_ID::SPANNER_TICKS, lastTick - s->tick());
else
s->computeEndElement();
}
s->computeEndElement();
}
}
for (auto s : sl) // actually remove scheduled spanners
undo(new RemoveElement(s));
for (auto s : sl2) { // shorten spanners that extended past end of score
undo(new ChangeProperty(s, P_ID::SPANNER_TICKS, lastTick - s->tick()));
s->computeEndElement();
}
}

}

0 comments on commit e44f841

Please sign in to comment.