From 3bb02e3c86f5f93dd4b61cb2dd81abdabd4edd7f Mon Sep 17 00:00:00 2001 From: Dylan Nicholson Date: Tue, 13 Jul 2021 08:34:57 +0200 Subject: [PATCH] Fix 322957 and #8592: fix issues discovered while moving grip handles around on trills Two unrelated issues, neither really to do with trill lines specifically at all but both discovered at the same time: a) if you drag the grip handle from any line into a 0-stave system (e.g. for a V-frame, as new scores have by default at the top of the score), it crashes b) a bug in the layout engine where it reused cached information from a previous layout caused erratic behaviour when dragging grip handles around, though it could be triggered in other ways, Backport of #8600 --- libmscore/layout.cpp | 2 ++ libmscore/line.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/libmscore/layout.cpp b/libmscore/layout.cpp index 3476e6c109a76..f8a4517598ab0 100644 --- a/libmscore/layout.cpp +++ b/libmscore/layout.cpp @@ -2110,6 +2110,8 @@ System* Score::getNextSystem(LayoutContext& lc) if (!isVBox) { int nstaves = Score::nstaves(); system->adjustStavesNumber(nstaves); + for (int i = 0; i < nstaves; ++i) + system->staff(i)->setShow(score()->staff(i)->show()); } return system; } diff --git a/libmscore/line.cpp b/libmscore/line.cpp index 86427924c19ad..c746942418658 100644 --- a/libmscore/line.cpp +++ b/libmscore/line.cpp @@ -403,7 +403,7 @@ Segment* LineSegment::findSegmentForGrip(Grip grip, QPointF pos) const System* sys = oldSeg->system(); const QList foundSystems = score()->searchSystem(pos, sys, spacingFactor); - if (!foundSystems.empty() && !foundSystems.contains(sys)) + if (!foundSystems.empty() && !foundSystems.contains(sys) && foundSystems[0]->staves()->size()) sys = foundSystems[0]; // Restrict searching segment to the correct staff