Skip to content

Commit

Permalink
Fix error in validMMRest logic
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-spa committed Mar 7, 2025
1 parent e478ead commit f7b1328
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions src/engraving/rendering/score/measurelayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ static bool validMMRestMeasure(const LayoutContext& ctx, const Measure* m)
if (!e->staff()->show() || !e->visible()) {
continue;
}
if (!muse::contains(BREAK_TYPES, e->type())) {
if (muse::contains(BREAK_TYPES, e->type()) && !s->rtick().isZero()) {
return false;
}
}
Expand Down Expand Up @@ -811,10 +811,27 @@ void MeasureLayout::createMultiMeasureRestsIfNeed(MeasureBase* currentMB, Layout
firstMeasure->setMMRestCount(0);
ctx.mutState().setMeasureNo(mno);
}
} else if (firstMeasure->isMMRest()) {
LOGD("mmrest: no %d += %d", ctx.state().measureNo(), firstMeasure->mmRestCount());
int measureNo = ctx.state().measureNo() + firstMeasure->mmRestCount() - 1;
ctx.mutState().setMeasureNo(measureNo);
} else if (firstMeasure->mmRest()) {
// Removed linked clones that were created for the mmRest measure
Measure* mmRestMeasure = firstMeasure->mmRest();
for (EngravingItem* item : mmRestMeasure->el()) {
item->unlink();
mmRestMeasure->remove(item);
delete item;
}
for (Segment* seg = mmRestMeasure->first(); seg && seg->rtick().isZero(); seg = seg->next()) {
for (EngravingItem* item : seg->annotations()) {
item->unlink();
seg->remove(item);
delete item;
}
}

if (firstMeasure->mmRestCount() > 0) {
LOGD("mmrest: no %d += %d", ctx.state().measureNo(), firstMeasure->mmRestCount());
int measureNo = ctx.state().measureNo() + firstMeasure->mmRestCount() - 1;
ctx.mutState().setMeasureNo(measureNo);
}
}
}

Expand Down

0 comments on commit f7b1328

Please sign in to comment.