Crash when modifying appoggiatura from imported MusicXml file.

• Jun 1, 2019 - 18:08
Reported version
3.1
Priority
P1 - High
Type
Functional
Frequency
Many
Severity
S3 - Major
Reproducibility
Always
Status
closed
Regression
No
Workaround
Yes
Project
Tags

Crash when modifying appoggiatura from imported MusicXml file.

When selecting an appoggiatura in the given file (imported from MusicXml), try to move the appoggiatura note up, then Musescore crashes.

Reproduced with 2.3.2 and 3.1.

This may be specific to the given data that was imported from a MusicXml file. If I create the appoggiatura inside musescore, no crash occurs.
The workaround is to rewrite all the appoggiatura inside Musescore.

Step to reproduce:

  • open the attached score tied_notes_crash.mscz
  • select the first note (the B appoggiatura)
  • hit the "up" key
  • the application crashes => WRONG

Expected behavior is to have the appoggiatura moved up without crash.

Callstack for the 2.3.2 version:

#0  0x0000555555efc808 in Ms::Note::tiedNotes (this=<optimized out>) at ./libmscore/note.cpp:2869
#1  0x0000555555f3490a in Ms::Selection::uniqueNotes (this=this@entry=0x555558c9ddd8, track=track@entry=-1) at ./libmscore/select.cpp:1163
#2  0x0000555555fc658e in Ms::Score::upDown (this=0x555558c9d940, up=true, mode=Ms::UpDownMode::CHROMATIC) at ./libmscore/score.h:719
#3  0x0000555555fcb820 in Ms::Score::cmd (this=0x555558c9d940, a=a@entry=0x555557984a40) at ./libmscore/cmd.cpp:2302
#4  0x0000555555976a8c in Ms::ScoreView::cmd (this=0x555558546400, a=a@entry=0x555557984a40) at ./mscore/scoreview.cpp:3385
#5  0x0000555555a3fb44 in Ms::MuseScore::cmd (this=0x555557717bf0, a=0x555557984a40, cmd=...) at ./mscore/musescore.cpp:5110
#6  0x0000555555a3fdf9 in Ms::MuseScore::cmd (this=0x555557717bf0, a=0x555557984a40) at ./mscore/musescore.cpp:4712
#7  0x0000555555d2fd71 in Ms::MuseScore::qt_static_metacall (_o=0x555557717bf0, _c=<optimized out>, _id=<optimized out>, _a=0x7fffffffd610)
    at ./obj-x86_64-linux-gnu/mscore/mscore_autogen/EWIEGA46WW/moc_musescore.cpp:744
#8  0x00007ffff29e6906 in QMetaObject::activate(QObject*, int, int, void**) () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#9  0x0000555555d2a342 in Ms::ScoreTab::actionTriggered (this=<optimized out>, _t1=<optimized out>) at ./obj-x86_64-linux-gnu/mscore/mscore_autogen/EWIEGA46WW/moc_scoretab.cpp:187
#10 0x00007ffff29e6906 in QMetaObject::activate(QObject*, int, int, void**) () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#11 0x00007ffff333569f in QActionGroup::triggered(QAction*) () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#12 0x00007ffff3336151 in ?? () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#13 0x00007ffff29e6906 in QMetaObject::activate(QObject*, int, int, void**) () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#14 0x00007ffff3331f02 in QAction::triggered(bool) () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#15 0x00007ffff3334510 in QAction::activate(QAction::ActionEvent) () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#16 0x00007ffff3334dc4 in QAction::event(QEvent*) () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#17 0x00007ffff33384b1 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#18 0x00007ffff333f950 in QApplication::notify(QObject*, QEvent*) () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#19 0x00007ffff29bd5a9 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#20 0x00007ffff2d93a43 in QShortcutMap::dispatchEvent(QKeyEvent*) () from /lib/x86_64-linux-gnu/libQt5Gui.so.5
#21 0x00007ffff2d93b1b in QShortcutMap::tryShortcut(QKeyEvent*) () from /lib/x86_64-linux-gnu/libQt5Gui.so.5
#22 0x00007ffff2d48f26 in QWindowSystemInterface::handleShortcutEvent(QWindow*, unsigned long, int, QFlags<Qt::KeyboardModifier>, unsigned int, unsigned int, unsigned int, QString const&, bool, unsigned short)
    () from /lib/x86_64-linux-gnu/libQt5Gui.so.5
#23 0x00007ffff2d6549d in QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent*) () from /lib/x86_64-linux-gnu/libQt5Gui.so.5
#24 0x00007ffff2d6ae05 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () from /lib/x86_64-linux-gnu/libQt5Gui.so.5
#25 0x00007ffff2d4506b in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib/x86_64-linux-gnu/libQt5Gui.so.5
#26 0x00007fffebdbf3eb in ?? () from /lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
#27 0x00007ffff29bc27b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#28 0x00007ffff29c4262 in QCoreApplication::exec() () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#29 0x000055555590227f in main (argc=<optimized out>, av=<optimized out>) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qcoreapplication.h:116

(End callstack)

It looks like the method Note::firstTiedNote() returns a NULL pointer that makes the Note::tiedNotes() method crashes.

Thanks

Attachment Size
tied_notes_crash.mscz 7.57 KB

Comments

After more investigations, the problem root is the slur tie that does not have an "end element" in this particular score, probably due to bad export/import of MusicXml file.

The attached patch fixes the crash and restores the correct behavior : the appoggiatura is moved up when pressing up key.

Best Regards

Attachment Size
fix_tied_notes_crash.patch 683 bytes

Are you planning to turn that into a proper pull request?

diff --git a/libmscore/note.cpp b/libmscore/note.cpp
index d76051a..c571a51 100644
--- a/libmscore/note.cpp
+++ b/libmscore/note.cpp
@@ -3108,9 +3108,10 @@ std::vector<Note*> Note::tiedNotes() const
 
       notes.push_back(note);
       while (note->tieFor()) {
-            if (std::find(notes.begin(), notes.end(), note->tieFor()->endNote()) != notes.end())
+            Note* endNote = note->tieFor()->endNote();
+            if (!endNote || std::find(notes.begin(), notes.end(), endNote) != notes.end())
                   break;
-            note = note->tieFor()->endNote();
+            note = endNote;
             notes.push_back(note);
             }
       return notes;

Possible relates to #270643: [EPIC] MusicXML import/export issues, although the above patch seems entirely unrelated

Fix version
3.2.0