Crash on XML Import
I'm using an Android app "Playscore", which will generate an XML file from a photo of a page of music (and play the music, but that's not my purpose). Usually, I can import the XML into Musescore - usually some corrections to be made, but the process works pretty well. Occasionally, I find an XML file that crashes Musescore. I've tried with both 2.1 and the nightlies and both crash. I'm assuming the XML file is malformed in some way, but I think Musescore should report an XML error rather than just crash. I've attached a file that causes a crash if someone is willing to try to diagnose the problem. This file won't harm your set-up, you'll just be able to restart Musescore (but don't load it alongside any unsaved edits). PlayScore_IMG_20171230_084222.xml
And here, in case it helps, is a file generated by the same process that loads into Musescore without causing a problem. PlayScore_20171226_095852.xml
Comments
Thanks for reporting this. Crash reproduces for me on a fairly recent master, assume it is structural.
Submitted issue #268009: [MusicXML import] Crash on XML Import caused by duplicate clef definition in multi-part file with late time signature. Will investigate.
In reply to Thanks for reporting this… by Leon Vinken
Thanks Leon,
I've found one problem that I can work round. The files that crash are missing a time signature.
I can work round it by manually inserting
after ... .
I assume the reason the time signature is missing is that PlayScore, which works on only one page at a time, doesn't see a time signature. So maybe Musescore needs to report missing time signature rather than crash, but whether it's possible then to carry on with importing the xml is less clear.
In reply to Thanks Leon,… by StuartC
Oops .. I inserted the XML code, which of course the browser interprets as html!
(/time)
In reply to Oops .. I inserted the XML… by StuartC
The actual issue is somewhat complicated. The offending file contains several duplicate clef or time signature definitions (i.e. more than one at the same time / same staff in the music). The one that causes the crash is at line 960, at the start of part three. MuseScore correctly detects the duplicate clef definition and tries to report in on the console. Unfortunately, the checking / reporting function Segment::checkElement() needs a valid time signature (which there isn't at this time) to report the error with measure and beat, so it crashes.
Obviously, MuseScore shouldn't crash, so I will implement a fix for this issue.
You may want to also report this as "incorrect MusicXML" to the PlayScore supplier.
In reply to The actual issue is somewhat… by Leon Vinken
Fixed, both in master and in 2.2.