Skip to content

Commit

Permalink
Merge pull request #3478 from Jojo-Schmitz/album-2.2
Browse files Browse the repository at this point in the history
Fix #105646: Create album of continuous-view scores crashes
  • Loading branch information
lasconic committed Feb 19, 2018
2 parents 3da85f4 + 20105a9 commit f11cf6e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion mscore/album.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,12 @@ bool Album::createScore(const QString& fn, bool addPageBreak, bool addSectionBre

Score* score = firstScore->clone();

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

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 != score->layoutMode())
score->endCmd(true); // rollback
score->fileInfo()->setFile(fn);
qDebug("Album::createScore: save file");
try {
Expand Down

0 comments on commit f11cf6e

Please sign in to comment.