Reversing the order of the instruments after creating parts leads to very bad result (corruption/crashes)

• Nov 27, 2020 - 11:07
Reported version
P1 - High
S2 - Critical

OS: Windows 10 (10.0), Arch.: x86_64, MuseScore version (64-bit):, revision: 465e7b6

1) Create a new score for two flutes, and a piccolo -> Ok
2) Create parts (All parts)
3) You are still in this dialog, but you realize that, finally, the piccolo should logically be located above the two flutes: so, go move up the Piccolo first in the parts -> Ok

You are here:


4) You now realize that in the main score, the Piccolo is always placed at the bottom of the list.

The test file at this step: test file flutes piccolo.mscz

5) Go to the Instruments dialog ("I"), and move the Piccolo to the very top of the list -> Ok

Like that:


Result: unfortunately, things are going wrong now. When you enter notes in the piccolo staff (or if you delete the contents, notes or measures), the corresponding part becomes badly corrupted, with empty measures (0/1)



  • I can't say for sure, but I wouldn't be surprised if this explains at least several of the observed cases of corruption of this type (empty measures) in parts in the recent/last months.

Incidentally, corruption appears in the same way when you change the order of another instrument, or instruments, at step #5.


Other example, with a template.
1) SATB + Piano template
2) Create parts (all parts) + move up the Piano to the top of the parts -> Ok
3) Press "I" -> Move up the piano instrument to the top -> Ok
4) In main score, enter a few notes in the piano staves (Treble clef or Bass clef, or both) and whatever where
5) Toggle to Piano part

Result: all measures involved are empty (0/1) in this part

  • Note: and of course, anything that is copied and pasted from the piano spreads the same corruption to the other parts.
Title Changing instruments order in the Dialog when parts have already been created leads to corruption in those parts. Reversing the order of the instruments after creating parts leads to very bad result (corruption/crashes)
Regression No Yes

I must say I'm a bit surprised that this issue report doesn't generate any reaction from the developers. It doesn't happen with version 2, it is very serious in its consequences (corruption kind empty measures 0/1, and it can spread in all parts) and the use case doesn't seem really far from the real life of the users.

An even simpler example.

1) New score for flute and violin
2) Create parts
3) Press "I" -> Move up the violin above the flute
4) Entering notes in the violin staff (main score)
5) Look at the violin part: a mess. With a completely corrupted staff of empty measures, and thus obvious underlying crashes.

The test file at this "final" step: violin flute.mscz

Somehow also I never saw it. Last week was a holiday in the US, that's my excuse. But also, much of this code is rewritten for 3.6, so there is a good chance some of this no longer applies. But I'll make sure we take a look.

Regression Yes No

I'm not sure it is a regression, issue can be reproduced with 3.3.4 and even 3.0.5. Looking at the code, it might be there from the beginning.
However, the good news the cause is found and I'm finalising a PR now.
Please note, the new score ordering most likely prevent this issue since instruments will be sorted in the right order from the starting :-)

Thank you for watching this issue.
When I was talking about regression, it was in relation to version 2.3.2.
You can notice that the same kind of file with Flute/Violin (and same 5 steps of my previous comment) does not lead to corruption in this version 2. See: Violin flute version 2.3.2.mscz

In reply to by cadiz1

Thank Marc for bringing under my attention at the developers chat :-).
The reason of this issue was the mapping between the master score and the part got lost when the order of instruments was changed. And when looking at the code it was that old I expect it would be there for ages already, hence I didn't try 2.3.2. And I was curious to see whether it was introduced in 3.5 since I made some changes in that part of the code :-)

Fix version