Changing time signature crashes Musescore - consistently.

• Aug 1, 2022 - 20:14

Background: I'd done this piece in with four quarter notes to the bar. My tutor suggested I change it to eighth notes. I followed instructions to select All, Cut and Paste Half Duration. That seemed successful. But in my original piece some bars changed from 4/4 to 3/4. I can change it at the correct point to 3/4 or 6/8 but when I select the next bar and change the time sig back to 4/4 Musescore crashes and closes.
To reproduce
1) check bar 10 - it changes to 6/8
2) select bar 11. From the sidebar select time signature 4/4 or C. There's a short whirling icon then Musescore crashes.
This happens every time I try it.

Windows 10, Musescore v3.6


Comments

Confirmed. stack trace:

1 Ms::ScoreElement::isChord scoreElement.h 266 0x105c0e0
2 Ms::ChordRest::isGrace chordrest.cpp 915 0x96d3f2
3 Ms::ScoreRange::write range.cpp 721 0xb77014
4 Ms::Score::rewriteMeasures edit.cpp 557 0x97f2c8
5 Ms::Score::rewriteMeasures edit.cpp 620 0x97f7f1
6 Ms::Score::cmdAddTimeSig edit.cpp 860 0x980c26
7 Ms::Measure::drop measure.cpp 1546 0xa29608
8 Ms::applyDrop palette.cpp 484 0x6c48d7
9 Ms::Palette::applyPaletteElement palette.cpp 740 0x6c6258
10 Ms::UserPaletteController::applyPaletteElement paletteworkspace.cpp 579 0x507dd7
11 Ms::AbstractPaletteController::qt_static_metacall moc_paletteworkspace.cpp 287 0x5f4000
12 Ms::AbstractPaletteController::qt_metacall moc_paletteworkspace.cpp 339 0x5f41ec
13 Ms::UserPaletteController::qt_metacall moc_paletteworkspace.cpp 432 0x5f437d
14 QQmlObjectOrGadget::metacall(QMetaObject::Call, int, void * *) const 0x66255e90
15 CallMethod(QQmlObjectOrGadget const&, int, int, int, int *, QV4::ExecutionEngine *, QV4::CallData *, QMetaObject::Call) 0x661a0674
16 CallPrecise(QQmlObjectOrGadget const&, QQmlPropertyData const&, QV4::ExecutionEngine *, QV4::CallData *, QMetaObject::Call) 0x661a17a4
17 QV4::QObjectMethod::callInternal(QV4::Value const *, QV4::Value const *, int) const 0x661a2564
18 QV4::Moth::VME::interpret(QV4::CppStackFrame *, QV4::ExecutionEngine *, const char *) 0x661b3e78
19 QV4::Moth::VME::exec(QV4::CppStackFrame *, QV4::ExecutionEngine *) 0x661b6dff
20 QV4::Function::call(QV4::Value const *, QV4::Value const *, int, QV4::ExecutionContext const *) 0x66158fae
...

Looks like there is a problem with a slur (maybe some slur that is having a note it starts on but none it ends at). Removing all slurs (as I don't yet see which slur exactly might be the culprit) and then apply the time sig change doesn't crash.

Possible fix (prevents the crash):

diff --git a/libmscore/range.cpp b/libmscore/range.cpp
index 1b008ffe40..05f9f261f5 100644
--- a/libmscore/range.cpp
+++ b/libmscore/range.cpp
@@ -718,7 +718,7 @@ bool ScoreRange::write(Score* score, const Fraction& tick) const
                         }
                   else
                         s->setStartElement(0);
-                  if (slur->endCR()->isGrace()) {
+                  if (slur->endCR() && slur->endCR()->isGrace()) {
                         Chord* sc = slur->endChord();
                         int idx   = sc->graceIndex();
                         Chord* dc = toChord(score->findCR(s->tick2(), s->track2()));

Not just 3.6.2 crashes on that, latest master code (which will become MuseScore 4) does too.
And the (basically) same fix apparently does fix the crash there too:

diff --git a/src/engraving/libmscore/range.cpp b/src/engraving/libmscore/range.cpp
index ea74c62fa1..b778c5891c 100644
--- a/src/engraving/libmscore/range.cpp
+++ b/src/engraving/libmscore/range.cpp
@@ -742,7 +742,7 @@ bool ScoreRange::write(Score* score, const Fraction& tick) const
             } else {
                 s->setStartElement(0);
             }
-            if (slur->endCR()->isGrace()) {
+            if (slur->endCR() && slur->endCR()->isGrace()) {
                 Chord* sc = slur->endChord();
                 size_t idx = sc->graceIndex();
                 Chord* dc = toChord(score->findCR(s->tick2(), s->track2()));

In reply to by Jojo-Schmitz

On the attached file, the crash is due to the slur that starts at measure 20, on the F (top instrument, ie piano), and goes on until measure 22 (over the 3/4 time signature, on the second beat, on the tied D)
Does not occur if the slur extends only on the first beat of this same measure
Reproducible from scratch.
See the GIF.

Video_2022-08-02_122326.gif

And on this file: TEST.mscz : crash by adding a 4/4 time signature to the second measure
And on this one: TEST1.mscz : crash by adding a 6/4 time signature, still in measure 2.

Please check whether this still happens with 4.0.2
I can't reproduce it any longer with any of the score attached here
Should have been fixed by b444d36e, so actually in 4.0 Beta already

Do you still have an unanswered question? Please log in first to post your question.