Skip to content

Commit

Permalink
Merge pull request #25913 from mike-spa/fixCrashOnEditSlurAcrossLinke…
Browse files Browse the repository at this point in the history
…dStaves

Fix crash on cross-staff slurs with TAB staves
  • Loading branch information
cbjeukendrup authored Dec 23, 2024
2 parents 79790fe + 4bd030d commit a6ce77e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/engraving/dom/slur.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,12 @@ bool SlurSegment::edit(EditData& ed)
return false;
}
if (cr && cr != e1) {
if (cr->staff() != e->staff() && (cr->staffType()->isTabStaff() || e->staffType()->isTabStaff())) {
return false; // Cross-staff slurs don't make sense for TAB staves
}
if (cr->staff()->isLinked(e->staff())) {
return false; // Don't allow slur to cross into staff that's linked to this
}
changeAnchor(ed, cr);
}
return true;
Expand Down Expand Up @@ -224,8 +230,10 @@ void SlurSegment::changeAnchor(EditData& ed, EngravingItem* element)
}
}
}
score()->undo(new ChangeStartEndSpanner(sp, se, ee));
renderer()->layoutItem(sp);
if (se && ee) {
score()->undo(new ChangeStartEndSpanner(sp, se, ee));
renderer()->layoutItem(sp);
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/engraving/rendering/score/slurtielayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1582,6 +1582,8 @@ void SlurTieLayout::createSlurSegments(Slur* item, LayoutContext& ctx)
{
const ChordRest* startCR = item->startCR();
const ChordRest* endCR = item->endCR();
assert(startCR && endCR);

const System* startSys = startCR->measure()->system();
const System* endSys = endCR->measure()->system();

Expand Down

0 comments on commit a6ce77e

Please sign in to comment.