MusicXML open crashes MS4
Issue type
Crash or freeze
Description with steps to reproduce
- Launch MuseScore
- From the File --> Open menu, select the attached file "crashing_import.mxl"
- Program crashes with no error given. Even if the XML file is corrupt or has an incorrect format, the MS should not crash.
Supporting files, videos and screenshots
In which versions of MuseScore Studio is this issue present?
OS: Windows 11 Version 25H2 or later, Arch.: x86_64, MuseScore Studio version (64-bit): 4.6.4-253300408, revision: github-musescore-musescore-7e32f16
Regression
I was unable to check
Operating system
Edition Windows 11 Home Version 25H2 Installed on 10/26/2025 OS build 26200.7171 Experience Windows Feature Experience Pack 1000.26100.265.0
Additional context
No response
Checklist
- [x] This report follows the guidelines for reporting bugs and issues
- [x] I have verified that this issue has not been logged before, by searching the issue tracker for similar issues
- [x] I have attached all requested files and information to this report
- [x] I have attempted to identify the root problem as concisely as possible, and have used minimal reproducible examples where possible
I can confirm the crash. Not a recent regression; also crashes going back to 4.2.1 at least. MU3 reports it is not valid: "Fatal error: line 2809 column 51 Element direction contains unknown attribute system" and then crashes.
Can you please re-test this in yesterday's 4.6.4 release build? We recently added a fix for a musicXML import crash, so it'd be good to verify whether this fixes it. Thanks!
This crashes for me on 4.6 and 4.7 nightlies
In case it helps here the stack trace from latest master:
MuseScore4.exe!mu::iex::musicxml::MusicXmlParserDirection::direction(const muse::String & partId, mu::engraving::Measure * measure, const mu::engraving::Fraction & tick, std::map<mu::engraving::SLine *,std::pair<int,int>,std::less<mu::engraving::SLine *>,std::allocator<std::pair<mu::engraving::SLine * const,std::pair<int,int>>>> & spanners, std::vector<mu::iex::musicxml::MusicXmlDelayedDirectionElement *,std::allocator<mu::iex::musicxml::MusicXmlDelayedDirectionElement *>> & delayedDirections, std::vector<mu::iex::musicxml::MusicXmlInferredFingering *,std::allocator<mu::iex::musicxml::MusicXmlInferredFingering *>> & inferredFingerings, std::multimap<int,mu::iex::musicxml::HarmonyDesc,std::less<int>,std::allocator<std::pair<int const ,mu::iex::musicxml::HarmonyDesc>>> & harmonyMap, bool & measureHasCoda, std::map<int,mu::engraving::Marker *,std::less<int>,std::allocator<std::pair<int const ,mu::engraving::Marker *>>> & segnos) Line 3764
at C:\Users\Jojo\Documents\GitHub\MuseScore\src\importexport\musicxml\internal\musicxml\import\importmusicxmlpass2.cpp(3764)
MuseScore4.exe!mu::iex::musicxml::MusicXmlParserPass2::measure(const muse::String & partId, const mu::engraving::Fraction time) Line 2779
at C:\Users\Jojo\Documents\GitHub\MuseScore\src\importexport\musicxml\internal\musicxml\import\importmusicxmlpass2.cpp(2779)
MuseScore4.exe!mu::iex::musicxml::MusicXmlParserPass2::part() Line 2264
at C:\Users\Jojo\Documents\GitHub\MuseScore\src\importexport\musicxml\internal\musicxml\import\importmusicxmlpass2.cpp(2264)
MuseScore4.exe!mu::iex::musicxml::MusicXmlParserPass2::scorePartwise() Line 2079
at C:\Users\Jojo\Documents\GitHub\MuseScore\src\importexport\musicxml\internal\musicxml\import\importmusicxmlpass2.cpp(2079)
MuseScore4.exe!mu::iex::musicxml::MusicXmlParserPass2::parse() Line 2005
at C:\Users\Jojo\Documents\GitHub\MuseScore\src\importexport\musicxml\internal\musicxml\import\importmusicxmlpass2.cpp(2005)
MuseScore4.exe!mu::iex::musicxml::MusicXmlParserPass2::parse(const muse::ByteArray & data) Line 1986
at C:\Users\Jojo\Documents\GitHub\MuseScore\src\importexport\musicxml\internal\musicxml\import\importmusicxmlpass2.cpp(1986)
MuseScore4.exe!mu::iex::musicxml::importMusicXmlfromBuffer(mu::engraving::Score * score, const muse::String & __formal, const muse::ByteArray & data) Line 103
at C:\Users\Jojo\Documents\GitHub\MuseScore\src\importexport\musicxml\internal\musicxml\import\importmusicxml.cpp(103)
MuseScore4.exe!mu::iex::musicxml::doValidateAndImport(mu::engraving::Score * score, const muse::String & name, const muse::ByteArray & data, bool forceMode) Line 210
at C:\Users\Jojo\Documents\GitHub\MuseScore\src\importexport\musicxml\internal\musicxml\import\importmusicxml.cpp(210)
MuseScore4.exe!mu::iex::musicxml::importCompressedMusicXml(mu::engraving::MasterScore * score, const muse::String & name, bool forceMode) Line 268
at C:\Users\Jojo\Documents\GitHub\MuseScore\src\importexport\musicxml\internal\musicxml\import\importmusicxml.cpp(268)
MuseScore4.exe!mu::iex::musicxml::MusicXmlReader::read(mu::engraving::MasterScore * score, const muse::io::path_t & path, const std::map<enum mu::project::INotationReader::OptionKey,muse::Val,std::less<enum mu::project::INotationReader::OptionKey>,std::allocator<std::pair<enum mu::project::INotationReader::OptionKey const ,muse::Val>>> & options) Line 43
at C:\Users\Jojo\Documents\GitHub\MuseScore\src\importexport\musicxml\internal\musicxmlreader.cpp(43)
MuseScore4.exe!mu::project::NotationProject::doImport(const muse::io::path_t & path, const muse::io::path_t & stylePath, bool forceMode, bool unrollRepeats) Line 300
at C:\Users\Jojo\Documents\GitHub\MuseScore\src\project\internal\notationproject.cpp(300)
MuseScore4.exe!mu::project::NotationProject::load(const muse::io::path_t & path, const muse::io::path_t & stylePath, bool forceMode, bool unrollRepeats, const std::string & format_) Line 116
at C:\Users\Jojo\Documents\GitHub\MuseScore\src\project\internal\notationproject.cpp(116)
MuseScore4.exe!mu::project::ProjectActionsController::loadWithFallback(const std::shared_ptr<mu::project::INotationProject> & project, const muse::io::path_t & loadPath, const std::string & format) Line 327
at C:\Users\Jojo\Documents\GitHub\MuseScore\src\project\internal\projectactionscontroller.cpp(327)
MuseScore4.exe!mu::project::ProjectActionsController::loadProject(const muse::io::path_t & filePath) Line 302
at C:\Users\Jojo\Documents\GitHub\MuseScore\src\project\internal\projectactionscontroller.cpp(302)
MuseScore4.exe!mu::project::ProjectActionsController::doOpenProject(const muse::io::path_t & filePath) Line 345
at C:\Users\Jojo\Documents\GitHub\MuseScore\src\project\internal\projectactionscontroller.cpp(345)
MuseScore4.exe!mu::project::ProjectActionsController::openProject(const muse::io::path_t & givenPath, const QString & displayNameOverride) Line 285
at C:\Users\Jojo\Documents\GitHub\MuseScore\src\project\internal\projectactionscontroller.cpp(285)
MuseScore4.exe!mu::project::ProjectActionsController::openProject(const mu::project::ProjectFile & file) Line 208
at C:\Users\Jojo\Documents\GitHub\MuseScore\src\project\internal\projectactionscontroller.cpp(208)
MuseScore4.exe!mu::appshell::ApplicationActionController::onDropEvent::__l8::<lambda_1>::operator()() Line 182
at C:\Users\Jojo\Documents\GitHub\MuseScore\src\appshell\internal\applicationactioncontroller.cpp(182)
[External Code]
MuseScore4.exe!`kors::async::Async::callQueue'::`2'::Func::call(const void * __formal) Line 142
at C:\Users\Jojo\Documents\GitHub\MuseScore\src\framework\global\thirdparty\kors_async\async\async.h(142)
MuseScore4.exe!kors::async::Async::queueData::__l2::<lambda_1>::operator()(const kors::async::CallMsg & m) Line 117
at C:\Users\Jojo\Documents\GitHub\MuseScore\src\framework\global\thirdparty\kors_async\async\async.h(117)
[External Code]
MuseScore4.exe!kors::async::RpcPort<kors::async::CallMsg>::process() Line 102
at C:\Users\Jojo\Documents\GitHub\MuseScore\src\framework\global\thirdparty\kors_async\async\internal\rpcqueue.h(102)
MuseScore4.exe!kors::async::QueuePool::processMessages(const std::thread::id & th) Line 216
at C:\Users\Jojo\Documents\GitHub\MuseScore\src\framework\global\thirdparty\kors_async\async\internal\queuepool.cpp(216)
MuseScore4.exe!kors::async::processMessages(const std::thread::id & th) Line 37
at C:\Users\Jojo\Documents\GitHub\MuseScore\src\framework\global\thirdparty\kors_async\async\processevents.h(37)
MuseScore4.exe!muse::async::processMessages(const std::thread::id & th) Line 29
at C:\Users\Jojo\Documents\GitHub\MuseScore\src\framework\global\async\processevents.h(29)
MuseScore4.exe!muse::GlobalModule::onPreInit::__l2::<lambda_1>::operator()() Line 242
at C:\Users\Jojo\Documents\GitHub\MuseScore\src\framework\global\globalmodule.cpp(242)
[External Code]
MuseScore4.exe!muse::TickerProvider::process() Line 96
at C:\Users\Jojo\Documents\GitHub\MuseScore\src\framework\global\internal\tickerprovider.cpp(96)
MuseScore4.exe!muse::TickerProvider::start::__l2::<lambda_1>::operator()() Line 46
at C:\Users\Jojo\Documents\GitHub\MuseScore\src\framework\global\internal\tickerprovider.cpp(46)
MuseScore4.exe!QtPrivate::FunctorCall<std::integer_sequence<unsigned __int64>,QtPrivate::List<>,void,`muse::TickerProvider::start'::`2'::<lambda_1>>::call::__l2::<lambda_1>::operator()() Line 116
at C:\Qt\6.10.1\msvc2022_64\include\QtCore\qobjectdefs_impl.h(116)
MuseScore4.exe!QtPrivate::FunctorCallBase::call_internal<void,`QtPrivate::FunctorCall<std::integer_sequence<unsigned __int64>,QtPrivate::List<>,void,`muse::TickerProvider::start'::`2'::<lambda_1>>::call'::`2'::<lambda_1>>(void * * args, QtPrivate::FunctorCall<std::integer_sequence<unsigned __int64>,QtPrivate::List<>,void,`muse::TickerProvider::start'::`2'::<lambda_1>>::call::__l2::<lambda_1> && fn) Line 65
at C:\Qt\6.10.1\msvc2022_64\include\QtCore\qobjectdefs_impl.h(65)
MuseScore4.exe!QtPrivate::FunctorCall<std::integer_sequence<unsigned __int64>,QtPrivate::List<>,void,`muse::TickerProvider::start'::`2'::<lambda_1>>::call(muse::TickerProvider::start::__l2::<lambda_1> & f, void * * arg) Line 115
at C:\Qt\6.10.1\msvc2022_64\include\QtCore\qobjectdefs_impl.h(115)
MuseScore4.exe!QtPrivate::FunctorCallable<`muse::TickerProvider::start'::`2'::<lambda_1>>::call<QtPrivate::List<>,void>(muse::TickerProvider::start::__l2::<lambda_1> & f, void * __formal, void * * arg) Line 337
at C:\Qt\6.10.1\msvc2022_64\include\QtCore\qobjectdefs_impl.h(337)
MuseScore4.exe!QtPrivate::QCallableObject<`muse::TickerProvider::start'::`2'::<lambda_1>,QtPrivate::List<>,void>::impl(int which, QtPrivate::QSlotObjectBase * this_, QObject * r, void * * a, bool * ret) Line 547
at C:\Qt\6.10.1\msvc2022_64\include\QtCore\qobjectdefs_impl.h(547)
[External Code]
MuseScore4.exe!main(int argc, char * * argv) Line 220
at C:\Users\Jojo\Documents\GitHub\MuseScore\src\app\main.cpp(220)
[External Code]
It dies at the delete in importmusicxmlpass1.cpp, line 3764
// handle the spanner stops first
for (MusicXmlSpannerDesc desc : stops) {
MusicXmlExtendedSpannerDesc& spdesc = m_pass2.getSpanner({ desc.tp, desc.nr });
if (spdesc.isStopped) {
m_logger->logError(u"spanner already stopped", &m_e);
delete desc.sp; <<<<<<<<<<<<<<<<<<<<<<<<here
} else {
if (spdesc.isStarted) {
// Adjustments to ottavas by the offset value are unwanted
As far as I can tell at a hairpin, actually a series of 4 of them (and all at the same address?!? and looking entirely identical), and the crash is on the 2nd. The 1st being a solid crescendo hairpin, the 2nd a dashed hairpin (?) with rather bizarre settings (now, on that 2nd run), like a negative line width, negative dash line and gap lenghts and ticks with negative numerator and denominator; seems all crap to me, some unitialized date or a dangeling pointer, some stack corruption.
When commenting out that delete it crashes at the delete on spanner starts rather than spanner ends. Commenting that one out too, and that MusicXML file finally loads.
I wonder whther the shere size of the score is causing these issues? It is 60 pages, 35 instruments and 225 measures, it also crashes whan going to the end og the score here in notesinchordselectionfiltermodel.cpp, line 221:
for (track_idx_t track = startTrack; track < endTrack; ++track) {
for (Segment* seg = startSeg; seg != endSeg; seg = seg->next1MM()) {
IF_ASSERT_FAILED(seg && seg->tick() < endSeg->tick()) {
break;
}