Appending measures makes saving crash if corrupt part

• Jun 10, 2019 - 12:33
Reported version
P0 - Critical
S2 - Critical

Steps to reproduce the issue:

  1. Open the attached file
  2. Add at least two measures
  3. Save the document

Resulting behavior

  • Program crash
  • Saved file is corrupted (some tags missing in the end for .mscx, empty file for .mscz)


Insert measures instead of adding them, and shifts the notes left


  • Adding one measure, saving, closing, re-opening, and only then add the second measure will also trigger the crash when saving
  • Adding notes before saving does not seem to do anything

Reproduced on

File created on

  • Musescore 3.0.1 on Windows 10 x64

(I have some previous versions of the file but all of them seems to trigger the crash)

Aknowledged issues

The following issues don't seem to be related, as reproducing the aforementioned steps one the files provided does not crash MuseScore (at least in 3.1).


#0  0x0000555555f9d2f0 in Ms::Segment::next1() const ()
#1  0x0000555555f4324a in Ms::Measure::write(Ms::XmlWriter&, int, bool, bool) const ()
#2  0x0000555556046ac8 in Ms::Score::writeMovement(Ms::XmlWriter&, bool) ()
#3  0x0000555556046c68 in Ms::Score::writeMovement(Ms::XmlWriter&, bool) ()
#4  0x00005555560471ad in Ms::Score::write(Ms::XmlWriter&, bool) ()
#5  0x000055555604729b in Ms::Score::saveFile(QIODevice*, bool, bool) ()
#6  0x000055555604745b in Ms::Score::saveFile(QFileInfo&) ()
#7  0x0000555555c58fb0 in Ms::MuseScore::saveAs(Ms::Score*, bool, QString const&, QString const&) ()
#8  0x0000555555c50f29 in Ms::MuseScore::saveAs(Ms::Score*, bool) ()
#9  0x0000555555a9fcb9 in Ms::MuseScore::cmd(QAction*, QString const&) ()
#10 0x0000555555aa134e in Ms::MuseScore::cmd(QAction*) ()

From d62a933231aad6dcae02d93cd9d3f83335a225a3. I can provide a core file if needed.

Attachment Size
WMGW-guitar-bass.mscz 22.64 KB


Oh, it is not "Insert measures" but "Append measures" that causses the crash on save.

There is a failed assertion (in a DEBUG build):

Fatal: ASSERT: "first()" in file ...\libmscore\measure.cpp, line 1919 (...\libmscore\measure.cpp:1919, )

2 lines earlier than the call to next1()

In my understanding, the fact of adding two measures is only a revealer here. The problem does not come from adding them. But, basically, because the part is corrupt. Save it, and look (and that's why the issue is fixed by removing and then recreating the part). guitar-bass.mscz
So it is likely to be related to this issue - very serious - that has not been resolved to date. Or even simply a duplicate of #290096: Remove select range in a score with parts results in corruption
Ie, what was called "timewise delete" is not synced in the parts.
The corruption is the same (look at the very end of the part) by adding measures to one of the test files attached to the bug report: test2 result corrupt.mscz

As far as I can remember, and I no longer know if this was still the case, corruption warning occurs when the corruption appears in the main score, but not in the parts.