Bug report - Crash when adding ties

• Sep 1, 2020 - 06:21

I seem to have created a file that is incredible at crashing musescore. Whenever I try to add a tie, which is pretty common in this piece (long pedal tones), it crashes musescore. I would very much appreciate if musescore could uhhhh not do that. This isn't even a super complicated piece and it's not very long either.

Attachment Size
Water.mscz 55.61 KB

Comments

In reply to by Jojo-Schmitz

In the score. Viola measure 14, changed whole to double whole to make the note tie over. Also tried adding a whole note in the next bar then tying it over, still crashed when I added the tie. Tuba part: separated and added back the tie in measure 14. It also crashes earlier in the tuba part when I do the same thing, making me believe that it doesn't matter where I do it.

In reply to by Splodinate

OK, I see, in the score deleting the existing tie in tuba measure 14 and adding a new one indeed crashes.

It does so also in the lasted 3.x development build, stack trace:
1 Ms::ScoreElement::isChord scoreElement.h 263 0xfd7b50
2 Ms::findLinkedChord edit.cpp 4133 0x91b7fb
3 Ms::Score::undoAddElement edit.cpp 4883 0x91fc8a
4 Ms::Score::cmdToggleTie edit.cpp 1388 0x90c0ad
5 Ms::ScoreView::::operator()(Ms::ScoreView *, const QByteArray &) const scoreview.cpp 2546 0x5f604e
6 std::_Function_handler>::_M_invoke(const std::_Any_data &, Ms::ScoreView *&&, const QByteArray &) std_function.h 316 0x61298f
7 std::function::operator()(Ms::ScoreView *, QByteArray const&) const std_function.h 706 0x1049cbd
8 Ms::ScoreView::cmd scoreview.cpp 2821 0x5fb511
9 Ms::ScoreView::cmd scoreview.cpp 2072 0x5f37e5
10 Ms::MuseScore::cmd musescore.cpp 6629 0x432a8c
11 Ms::MuseScore::cmd musescore.cpp 6051 0x42f351
12 Ms::MuseScore::qt_static_metacall moc_musescore.cpp 518 0x5a0ed2
13 QMetaObject::activate(QObject *, int, int, void * *) 0x68a947c8
14 Ms::ScoreTab::actionTriggered moc_scoretab.cpp 225 0x5bf60e
15 Ms::ScoreTab::qt_static_metacall moc_scoretab.cpp 110 0x5bf096
16 QMetaObject::activate(QObject *, int, int, void * *) 0x68a947c8
17 QActionGroup::hovered(QAction *) 0x2ad04db2
18 QActionGroup::qt_static_metacall(QObject *, QMetaObject::Call, int, void * *) 0x2ad0573c
19 QMetaObject::activate(QObject *, int, int, void * *) 0x68a947c8
20 QAction::activate(QAction::ActionEvent) 0x2ad03e0e
...

I do suspect a corruption in the part, somehow the link between score and parts seems to have gotten lost.

And indeed, removing and regenerating all parts fixes the crash.

In the original score, in score the tuba as 2 tied whole notes, the parts has 4 tied whole notes, so certainly this score is corrupt.

In reply to by Splodinate

The crash could get prevended:

diff --git a/libmscore/measure.cpp b/libmscore/measure.cpp
index d86a84a83..03aced7df 100644
--- a/libmscore/measure.cpp
:...skipping...
diff --git a/libmscore/edit.cpp b/libmscore/edit.cpp
index 9f7c35cd3..f58afb2e5 100644
--- a/libmscore/edit.cpp
+++ b/libmscore/edit.cpp
@@ -4129,8 +4129,8 @@ static Chord* findLinkedChord(Chord* c, Staff* nstaff)
       Segment* s  = c->segment();
       Measure* nm = nstaff->score()->tick2measure(s->tick());
       Segment* ns = nm->findSegment(s->segmentType(), s->tick());
-      Element* ne = ns->element(dtrack);
-      if (!ne->isChord())
+      Element* ne = ns ? ns->element(dtrack) : 0;
+      if (!ne || !ne->isChord())
             return 0;
       Chord* nc = toChord(ne);
       if (c->isGrace()) {
@@ -4882,13 +4882,13 @@ void Score::undoAddElement(Element* element)
                               sm = cr2->staffIdx() - cr1->staffIdx();
                         Chord* c1 = findLinkedChord(cr1, score->staff(staffIdx));
                         Chord* c2 = findLinkedChord(cr2, score->staff(staffIdx + sm));
-                        Note* nn1 = c1->findNote(n1->pitch(), n1->unisonIndex());
+                        Note* nn1 = c1 ? c1->findNote(n1->pitch(), n1->unisonIndex()) : 0;
                         Note* nn2 = c2 ? c2->findNote(n2->pitch(), n2->unisonIndex()) : 0;
 
                         // create tie
                         Tie* ntie = toTie(ne);
                         ntie->eraseSpannerSegments();
-                        ntie->setTrack(c1->track());
+                        ntie->setTrack(c1 ? c1->track() : 0);
                         ntie->setStartNote(nn1);
                         ntie->setEndNote(nn2);
                         undo(new AddElement(ntie));

That would not fix the corruption though and would still crash in Debug mode, unless an additional change is made:

diff --git a/libmscore/measure.cpp b/libmscore/measure.cpp
index d86a84a83..03aced7df 100644
--- a/libmscore/measure.cpp
+++ b/libmscore/measure.cpp
@@ -1897,8 +1897,8 @@ void Measure::write(XmlWriter& xml, int staff, bool writeSystemElements, bool fo
             if (!e->generated() && ((e->staffIdx() == staff) || (e->systemFlag() && writeSystemElements)))
                   e->write(xml);
             }
-      Q_ASSERT(first());
-      Q_ASSERT(last());
+      //Q_ASSERT(first());
+      //Q_ASSERT(last());
       if (first() && last())
             score()->writeSegments(xml, strack, etrack, first(), last()->next1(), writeSystemElements, forceTimeSig);

Not sure this is worth the effort.

In reply to by Jojo-Schmitz

Hi.
So, yeah, this is very frustrating. A lot of my music has "lifts" on the "&" of 4, tied into the next bar for a beat & a half. So, I usually write the chord on "1" of the next bar, then make it a 1/8th note, then cut (or copy) it, then past it on the "&" of 4 of the preceding bar, and then make it of length "half note" with the intention that an "1/8th" stays in the preceeding bar and a dotted "1/4" is tied to in the next bar. I either do that or, if I've copied and not cut the note, I tie the note across the bar line.
It is crashing everytime--and (although it's only visible sometimes if I ask it to reload) indeed the destination bar is corrupted. It's as though Musescore corrupts the bar if one cuts out a a note from it, as the corruption report suggested that the bar was 10/8 and not 4/4.
Measure 2, staff 2 incomplete. Expected: 4/4; Found: 10/8
Measure 2, staff 3 incomplete. Expected: 4/4; Found: 10/8
And, notably, some bars, if you select them, have "End Beat: 4", while others have "End Beat: 4.5", even tho they have the same phrase timing in them.
Best/Thanks,

Attachment Size
Quintessence E CHART COPY.mscz 56.22 KB

In reply to by bobjp

Hi & thanks for feedback--but why "R"? If I hit (on Mac) "Shift +" or hit the tie button, it just crashes.
As I said, I think that Musescore somehow still wants to associate the "copied/cut from next bar and pasted into last bar" chord with the 'next bar', as when the file is recovered, the corruption messages shows that the formerly good bar is now some non 4/4 or 8/8.
It's almost as though the older, what pre-3.5/3.6 files, aren't being parsed/processed properly for this kind of action--or it has introduced some kind of "this note belongs to that bar".
So, essentially, I have to re-create in New 3.6 files any of my tunes that I wish to make mods to--and that's usually on "do I &-of-4 that chord or not".
Otherwise, what a great effort Musescore is!
Cheers/Thanks,
Elliot

In reply to by Elliot Freedman

In your score, I deleted the first note(s), in the second measure of the guitar part. This is like you just finished the first measure. Select one of the notes on the and of four. Hit "R". In 3.6.2 that copies the three 8th note cord to the first beat of measure two. Select the all three notes of the cord on the and of four in measure 1. Hit the +. That ties the notes.
If I understand your post, you copy + pasted back into measure 1. But I don't know why. Or why you would hit shift +.

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