Crash when extending note into "let ring" and "Palm Mute"

• Apr 11, 2020 - 14:32
Reported version
3.4
Type
Functional
Frequency
Once
Severity
S2 - Critical
Reproducibility
Always
Status
closed
Regression
No
Workaround
No
Project

Create new score with guitar

Add consecutive notes

Place let ring line on the second note

Use a keyboard shortcut to extend/dot the first note into the second

Musescore crashes


Comments

Title Crash when extending note into let ring Crash when extending note into "let ring" and "Palm Mute"
Severity S3 - Major S2 - Critical

Same result for the Palm Mute line (P.M.) - from memory, these two lines were implemented together.
Test file: ring palm.mscz
Select the first note and increase its value (dotted quarter note, e.g.), leads to the crash.

Latest development version crashes too.

Stack trace:
1 Ms::LetRing::linePos letring.cpp 227 0x835bfc
2 Ms::SLine::layoutSystem line.cpp 776 0x7fcf0b
3 Ms::processLines layout.cpp 3228 0x7ee05a
4 Ms::Score::layoutSystemElements layout.cpp 3930 0x7f2b0c
5 Ms::Score::collectSystem layout.cpp 3576 0x7efc81
6 Ms::LayoutContext::collectPage layout.cpp 4198 0x7f449e
7 Ms::LayoutContext::layout layout.cpp 4511 0x7f60fe
8 Ms::Score::doLayoutRange layout.cpp 4499 0x7f6061
9 Ms::Score::update cmd.cpp 302 0x919236
10 Ms::Score::endCmd cmd.cpp 260 0x918ed6
11 Ms::Score::cmd cmd.cpp 4137 0x92d160
12 Ms::ScoreView::cmd scoreview.cpp 2562 0x6044d1
13 Ms::ScoreView::cmd scoreview.cpp 1823 0x5fc95f
14 Ms::MuseScore::cmd musescore.cpp 6485 0x431c0b
15 Ms::MuseScore::cmd musescore.cpp 5923 0x42e6cd
16 Ms::MuseScore::qt_static_metacall moc_musescore.cpp 513 0x5b83b7
17 QMetaObject::activate(QObject *, int, int, void * *) 0x68a947c8
18 Ms::ScoreTab::actionTriggered moc_scoretab.cpp 225 0x5d54e6
19 Ms::ScoreTab::qt_static_metacall moc_scoretab.cpp 110 0x5d4f6e
20 QMetaObject::activate(QObject *, int, int, void * *) 0x68a947c8
...

Band aid:

$ git diff
diff --git a/libmscore/letring.cpp b/libmscore/letring.cpp
index c03c108c5..d69ecd2cb 100644
--- a/libmscore/letring.cpp
+++ b/libmscore/letring.cpp
@@ -224,6 +224,8 @@ QPointF LetRing::linePos(Grip grip, System** sys) const
       System* s = nullptr;
       if (grip == Grip::START) {
             ChordRest* c = toChordRest(startElement());
+            if (!c)
+                  return QPointF();
             s = c->segment()->system();
             x = c->pos().x() + c->segment()->pos().x() + c->segment()->measure()->pos().x();
             if (c->isRest() && c->durationType() == TDuration::DurationType::V_MEASURE)
diff --git a/libmscore/palmmute.cpp b/libmscore/palmmute.cpp
index cedeef1c3..70c7b8a70 100644
--- a/libmscore/palmmute.cpp
+++ b/libmscore/palmmute.cpp
@@ -208,6 +208,8 @@ QPointF PalmMute::linePos(Grip grip, System** sys) const
       System* s = nullptr;
       if (grip == Grip::START) {
             ChordRest* c = toChordRest(startElement());
+            if (!c)
+                  return QPointF();
             s = c->segment()->system();
             x = c->pos().x() + c->segment()->pos().x() + c->segment()->measure()->pos().x();
             if (c->isRest() && c->durationType() == TDuration::DurationType::V_MEASURE)

Prevents the crash, but these lines look different after, they now start on the left border:
ring_palm.png
OTH not sure what else to expect? The behavior of ottava-, pedal-, trill-, (de)crescendo-, text lines or hairpins is different but not really any better

Fix version
3.5.0