Crash on importing MusicXML
Trying to open MusicXML files, I experience multiple crashes. One is with an empty file, with no content. MuseScore complains that "Element part-list is missing child element." , which is OK, but if I answer "Yes" to the question "Do you want to try to load this file anyway", MuseScore crashes.
If I try to open another file with content, it opens without questions or problems. But then, if I select the whole content, either by clicking in the first measure and shift-clicking in the last one, or clicking in the first measure and typing Ctrl+Shift+end, MuseScore crashes.
If I select progressively, clicking in the first measure, then Shift-clicking every five or six measures, I can succeed in selecting the whole staff and copying it. After that, selection works normally. (I can deselect and reselect directly from first to last measure.) Not sure whether this is due to my configuration or a more general problem.
Attachment | Size |
---|---|
OneNoteSamba_music.xml | 422 bytes |
OneNoteSamba_alto1.xml | 118.81 KB |
Comments
No crash here (on that OneNoteSamba_music.xml), MuseScore 3.6.2 on Windows 11, but no import either. And no wonder, looking at the (very little) content:
It is basically empty, so there's nothing to import. As it doesn't crash (for me at least) I'm not sure this is worth fixing?
In reply to No crash here (on that… by Jojo-Schmitz
The current development builds for master (which will become MuseScore 4), imports it an an empty file.
In reply to No crash here (on that… by Jojo-Schmitz
Hmm, I got 3.6.2 to crash on it too now.
In reply to Hmm, I got it to crash too… by Jojo-Schmitz
Seems yet another simple 1-line fix, added to PR #9000
But the crash in that PR (before the fix) is different from the one in 3.6.2, and also doesn't happen at all in the 3.x branch (which PR #9000 is based on)
So it seems the issue got fixed in 3.x and then broke again later, looking that fix I came up with in https://github.com/musescore/MuseScore/pull/8530, which in turn isn't (yet) in master...
In reply to Seems yet another simple 1… by Jojo-Schmitz
I see now, #321730: Crash on corrupt MXL import is what fixed it (for the 3.x and the master branch)
I can confirm the crash on 'Ctrl+A' on that other score though, OneNoteSamba_alto1.xml
Stack trace:
1 Ms::Element::parent element.h 199 0x1061a7c
2 Ms::Segment::measure segment.h 130 0x10631b8
3 Ms::Segment::tick segment.cpp 214 0xa8b436
4 Ms::Selection::appendChord select.cpp 505 0xa9657c
5 Ms::Selection::updateSelectedElements select.cpp 589 0xa96fe1
6 Ms::Score::selectRange score.cpp 3313 0xa8018f
7 Ms::Score::cmdSelectAll score.cpp 3724 0xa81c32
8 Ms::Score::::operator()(Ms::Score *, Ms::EditData &) const cmd.cpp 4275 0x54ade4
9 std::_Function_handler>::_M_invoke(const std::_Any_data &, Ms::Score *&&, Ms::EditData &) std_function.h 297 0x55d2ba
10 std::function::operator()(Ms::Score *, Ms::EditData&) const std_function.h 687 0x10d022d
11 Ms::Score::cmd cmd.cpp 4327 0x54d1db
12 Ms::ScoreView::cmd scoreview.cpp 2895 0x64c5c5
13 Ms::ScoreView::cmd scoreview.cpp 2089 0x643c47
14 Ms::MuseScore::cmd musescore.cpp 6617 0x433ff0
15 Ms::MuseScore::cmd musescore.cpp 6044 0x43093a
16 Ms::MuseScore::qt_static_metacall moc_musescore.cpp 610 0x5f060d
17 void doActivate(QObject *, int, void * *) 0x68b978bb
18 Ms::ScoreTab::actionTriggered moc_scoretab.cpp 226 0x60fa78
19 Ms::ScoreTab::qt_static_metacall moc_scoretab.cpp 111 0x60f4e7
20 void doActivate(QObject *, int, void * *) 0x68b978bb
...
In reply to I can confirm the crash on … by Jojo-Schmitz
Easy 1-line fix:
I'll add it to my PR #9000 and will check whether it is neeeded for master (which will become MuseScore 4) too
In reply to Easy 1-line fix: diff --git… by Jojo-Schmitz
master seems to crash too. Seems to be using the same code, so the same fix should apply.
In reply to master seems to crash too. by Jojo-Schmitz
Created https://github.com/musescore/MuseScore/pull/10860 for this
In reply to Created https://github.com… by Jojo-Schmitz
Thanks!
In reply to I can confirm the crash on … by Jojo-Schmitz
Strange enough: There is no crash when saving the imported XML as an MSCZ, closing and reopening it and doing that "select all" then.
In reply to Strange enough: There is no… by Jojo-Schmitz
Yes, that's strange, like the fact that it is possible to select all incrementally (selecting a few measures and then adding a few measures to the selection until all measures are selected). Furthermore, once all has been selected and copied this way, the "select all" command no longer crashes MuseScore!
The OneNoteSambe_alto1.xml crash is triggered when adding measure 43's last note to the selection (1/8 F4 at measure 43 beat 4.5). It contains an invisible glissando with an end note at tick 0/1.
The MusicXML file indeed has a glissando start at that note and a corresponding glissando stop in the next measure at a grace note attached to a rest. The grace note is invisible in MuseScore's GUI, which may indicate an import problem leading to the issue.
File OneNoteSamba_music.xml does cause a crash for me (3.x on MacOS). Suspect uninitialised memory, as the MusicXML file does not contain any music and the crash is caused by a null pointer. Stack trace:
* frame #0: 0x000000010127fecc mscore
Ms::SegmentList::last(this=0x0000000000000128) const at segmentlist.h:46
Ms::Measure::last(this=0x0000000000000000) const at measure.h:153frame #1: 0x00000001012593fc mscore
frame #2: 0x00000001011193fe mscore
Ms::Measure::endBarLine(this=0x0000000000000000) const at measure.cpp:3648
Ms::Measure::endBarLineType(this=0x0000000000000000) const at measure.cpp:3669frame #3: 0x00000001011196b5 mscore
frame #4: 0x0000000100ddc06b mscore
Ms::MusicXMLParserPass2::scorePartwise(this=0x00007ffeefbfbcb8) at importmxmlpass2.cpp:1582
Ms::MusicXMLParserPass2::parse(this=0x00007ffeefbfbcb8) at importmxmlpass2.cpp:1542frame #5: 0x0000000100ddbd53 mscore
frame #6: 0x0000000100ddbcb8 mscore
Ms::MusicXMLParserPass2::parse(this=0x00007ffeefbfbcb8, device=0x00007ffeefbfc290) at importmxmlpass2.cpp:1523
Ms::importMusicXMLfromBuffer(score=0x000000010d588800, (null)=0x00007ffeefbfc680, dev=0x00007ffeefbfc290) at importmxml.cpp:57frame #7: 0x0000000100d9cc9a mscore
frame #8: 0x0000000100e2062f mscore
Ms::doValidateAndImport(score=0x000000010d588800, name=0x00007ffeefbfc680, dev=0x00007ffeefbfc290) at importxml.cpp:235
Ms::importMusicXml(score=0x000000010d588800, name=0x00007ffeefbfc680) at importxml.cpp:281frame #9: 0x0000000100e208ac mscore
In reply to File OneNoteSamba_music.xml… by Leon Vinken
The fix for that is simple:
And not needed in 3.6.2 nor (yet) in master, as I outlined further up