MuseScore
MuseScore copied to clipboard
[MU4 Issue] Export This score to Xml cause crash
I have a score who crash when i try to export to XML. I try to remove all in this score and score continue to crash
1-Load Score provifded (Yes it's a ascore with empty measures, do the same when notes are in it ) 2-Try to make a XML export 3-Result in crash
OS: Windows 10 Version 2009, Arch.: x86_64, MuseScore version (64-bit): 4.0.1-230120506, revision: github-musescore-musescore-f23ceb1 TestParts.zip
Find the reason of the crash!!!!!!
1 - Create Score
2 - Add repeat sign in measure 3
3 - Select 2d Measure and type "R", This replace Repeat sign.
4 - Try to export result in crash
If you have saved the file before crash
Remove 3th Measure using "suppr" youu see that the measure is corrupted. No rest

Very very hard to understand and reproduce from scratch
OS: Windows 10 Version 2009, Arch.: x86_64, MuseScore version (64-bit): 4.0.1-230140506, revision: github-musescore-musescore-9b70a8c
@Gai-Luron Thanks very much, that's very useful!!! So this is in fact another case of score corruption!
I did a bit of investigation, and this seems related somewhat related to https://github.com/musescore/MuseScore/issues/15874. When pasting (or using "repeat selection"), the measure repeats in the target measure are not properly deleted, which results in this behaviour. So far, I can't really make sense of why that is happening.
relevant places in the code:
- Here we're removing the measure repeat but it turns out to be the one in the next next measure, so one measure too far. https://github.com/musescore/MuseScore/blob/7a0bfc4b56e7cb3e747e0e751877f9460c494fd5/src/engraving/libmscore/paste.cpp#L257-L260
- Here we're doing something very dirty with a measure repeat, somehow cloning it but to a Rest instead of a Measure Repeat. This causes a crash, see #15904. But even when that crash is fixed, it is still very dirty, and especially we are not properly removing the measure repeat (we're removing the element, but the measure itself still thinks it's a measure repeat measure). https://github.com/musescore/MuseScore/blob/7a0bfc4b56e7cb3e747e0e751877f9460c494fd5/src/engraving/libmscore/edit.cpp#L402-L408
To add to this scenario (and it also results in a crash when exporting to XML):
Create a score and use some measure repeats:

Now select the second measure and press 'R':

Result is the "repeated measure" is copied without the rests and a second measure repeat is replace with a measure rest.
Export to XML now will crash MS4.
I'm getting same crash when also trying to export the same file to midi.
@Gai-Luron - Can you check again?
Is this issue still happening with 4.0.1? If not, can you check to see if it's solved in 4.0.2?
This still happens in 4.0.1, 4.0.2 and master.
Fixed in #16165