fix #275730: Crash when switching in Page View if mm rests are shown

This commit is contained in:
Matt McClinch 2018-08-29 12:20:20 -04:00
parent 4e75c325ef
commit 0e4b2e0059
2 changed files with 5 additions and 2 deletions

View file

@ -83,6 +83,9 @@ static void processLines(System* system, std::vector<Spanner*> lines, bool align
if (!firstMeasure()) if (!firstMeasure())
return; return;
for (MeasureBase* mb = first(); mb; mb = mb->next())
mb->setSystem(nullptr);
auto page = new Page(this); auto page = new Page(this);
pages().push_back(page); pages().push_back(page);
page->bbox().setRect(0.0, 0.0, loWidth(), loHeight()); page->bbox().setRect(0.0, 0.0, loWidth(), loHeight());

View file

@ -5768,7 +5768,7 @@ void MuseScore::switchLayoutMode(LayoutMode mode)
{ {
// find a measure to use as reference, if possible // find a measure to use as reference, if possible
QRectF view = cv->toLogical(QRect(0.0, 0.0, width(), height())); QRectF view = cv->toLogical(QRect(0.0, 0.0, width(), height()));
Measure* m = cs->firstMeasure(); Measure* m = cs->firstMeasureMM();
while (m && !view.intersects(m->canvasBoundingRect())) while (m && !view.intersects(m->canvasBoundingRect()))
m = m->nextMeasureMM(); m = m->nextMeasureMM();
@ -5784,7 +5784,7 @@ void MuseScore::switchLayoutMode(LayoutMode mode)
// also, better positioning is usually achieved if you start from the top // also, better positioning is usually achieved if you start from the top
// and there is really no better place to position canvas if we were all the way off page previously // and there is really no better place to position canvas if we were all the way off page previously
cv->pageTop(); cv->pageTop();
if (m && m != cs->firstMeasure()) if (m && m != cs->firstMeasureMM())
cv->adjustCanvasPosition(m, false); cv->adjustCanvasPosition(m, false);
} }