[MusicXML import] Crash caused by unsupported QVariant
Saving a file imported from MusicXML in .mscx or .mscz format sometimes crashes MuseScore with error message "XmlWriter::tag: unsupported type 38 float". Cause is a combination of two things:
1) in file mscore/importmxmlpass1.cpp function updateStyles() style elements lyricsOddFontSize and lyricsEvenFontSize are set to a QVariant(float) instead of QVariant(double)
2) XmlWriter::tag() supports QVariant::Double but does not support QVariant::Float
Changing updateStyles() to use doubles solves the problem (as would supporting QVariant::Float in XmlWriter::tag()
Comments
As far as I can see
QVariant::Float
doesn't exist, justQVariant::Double
See http://doc.qt.io/qt-5/qvariant-obsolete.html#Type-enum
Is 3.0 also affected by this?
Still there is a constructor of
QVariant
for a float value: http://doc.qt.io/qt-5/qvariant.html#QVariant-12And
QMetaType
enum contains float either: http://doc.qt.io/qt-5/qmetatype.html#Type-enumAnd we seem to be not the only people wondering about this :) See https://stackoverflow.com/q/31290606
So perhaps we should update the code in
xmlwriter.cpp
to use the newQMetaType
list of types?Implemented option 1) in PR https://github.com/musescore/MuseScore/pull/4023. Chose this as the MusicXML importer is the part of MuseScore using a Variant containing a float.
This specifically affect 3.0, not sure about 2.3.x.
Jojo is right (I was a bit imprecise): QVariant::Float indeed doesn't exist. That doesn't affect the outcome, as Variant does support float and XmlWriter::tag() doesn't, which causes the issue.
Fixed in branch master, commit 83fc747473
fix #277029 - [MusicXML import] Crash caused by unsupported QVariant
Fixed in branch master, commit 539d98c07e
Merge pull request #4023 from lvinken/277029-qvariant-float
fix #277029 - [MusicXML import] Crash caused by unsupported QVariant
Automatically closed -- issue fixed for 2 weeks with no activity.