Skip to content

Commit

Permalink
Fix #105646: Create album of continuous-view scores crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
Jojo-Schmitz committed Feb 19, 2018
1 parent ae2b690 commit 2051d6a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion mscore/album.cpp
Expand Up @@ -147,6 +147,9 @@ bool Album::createScore(const QString& fn, bool addPageBreak, bool addSectionBre
return false;
}

LayoutMode layoutMode = firstScore->layoutMode();
firstScore->switchToPageMode();

// do layout for first score's root and excerpt scores
firstScore->doLayout();
for (int i = 0; i < firstScore->excerpts().count(); i++) {
Expand All @@ -163,7 +166,7 @@ bool Album::createScore(const QString& fn, bool addPageBreak, bool addSectionBre

int excerptCount = firstScore->excerpts().count();
bool joinExcerpt = true;
for (AlbumItem* item : _scores) {
for (AlbumItem* item : _scores) {
if (item->score == 0 || item->score == firstScore)
continue;
if (item->score->excerpts().count() != excerptCount) {
Expand All @@ -183,6 +186,7 @@ bool Album::createScore(const QString& fn, bool addPageBreak, bool addSectionBre
continue;

// try to append root score
item->score->ScoreElement::undoChangeProperty(P_ID::LAYOUT_MODE, int(LayoutMode::PAGE));
item->score->doLayout();
if (!score->appendScore(item->score, addPageBreak, addSectionBreak)) {
qDebug("Cannot append root score of album item \"%s\".", qPrintable(item->name));
Expand Down Expand Up @@ -212,6 +216,8 @@ bool Album::createScore(const QString& fn, bool addPageBreak, bool addSectionBre
}
}

if (layoutMode != firstScore->layoutMode())
firstScore->endCmd(true); // rollback
score->fileInfo()->setFile(fn);
qDebug("Album::createScore: save file");
try {
Expand Down

0 comments on commit 2051d6a

Please sign in to comment.