MS crashes when insert a measure (incorrect handling of the [Measure]<tick> tag)

• Oct 5, 2015 - 13:40
Reported version
S2 - Critical
won't fix

How to reproduce:
1. Open attached 3_Corcovado - AC Jobim.mscz
2. Hit the INSERT to add a measure
-> MS crashes

How that happend - well before I was dealing correcting measures that were too long.
For reference I attached the old MS 1 File Corcovado - AC Jobim.mscz I was starting to work on.


It crashed on me even after a simple (and single) click into measure 3
MuseScore 2.0.2, as well as the latest development build, Windows 7, (Enterprise, 64bit)

Stack trace
0 Ms::Segment::tick segment.cpp 757 0x7bd423
1 Ms::Selection::updateSelectedElements select.cpp 496 0x78127f
2 Ms::Score::selectRange score.cpp 2966 0x76a8ed
3 Ms::Score::select score.cpp 2753 0x769b43
4 Ms::Score::selectSingle score.cpp 2772 0x769bc4
5 Ms::Score::select score.cpp 2751 0x769b12
6 Ms::ScoreView::select scoreview.cpp 3537 0x4148bd
7 Ms::SelectTransition::onTransition scoreview.cpp 472 0xb1dc63
8 ZN20QStateMachinePrivate24executeTransitionContentEP6QEventRK5QListIP19QAbstractTransitionE 0x68a916dc
9 ?? 0x19fc0000
10 ??

It's unfortunately the case that corrupt scores are likely to eventually lead to crashes, but still good for us to try to fix the cases where we can.

In this case, there are likely to be lots of problems all stemming from the same root cause: there is an inappropriate "tick" tag at the beginning of measure three that is making MuseScore think the measure itself begins with the second note of the triplet. That is, measure three should begin with tick 3840, but the tick tag in the score says 3960. This is resulting in the first segment of the measure having a tick offset of 120 rather than 0, which violates what I think to be kind of a fundamental assumption about a score.

It would be easy to fix the specific crash that occurs when clicking the measure - testing for a null start segment when trying to set the selection range. But I suspect there woud be tons of other things that would crash or cause other serious problems if we don't correct the problem when importing the score. Unfortunately, I am not sure what that would entail.

Looking back at tht original 1.X file, I can see the corresponding measure (14) has a "tick" tag at the beginning of the measure for the benefit of the chord symbol, but the tuplet itself resets the tick. I don't think either of the values there are correct, but I am not positive. Anyhow, somehow I guess that didn't get interptered quite correctly, and in the process of editing the file, it got corrupted into what we see in the 2.0 version.

Title MS crashes when insert a measure MS crashes when insert a measure (incorrect handling of the [Measure]<tick> tag)

Thanks for the quick reply.

Found a workaround:
Just save file as uncompressed. like this: Err_Corcovado - AC Jobim.mscx
open it in an editor like notepad++
1. Solve measure problems on XML-level (okay that's a little hackish)
Like search for "14" or "32" to seek to a measure that were reported as problematic
delete or add rests / dots to the timing fits again
2. replace 'tick' -> 'fick'
^-that step is important and prevent MS from crashing
MS will ignore the unknown tags and on next save they'll be gone:
ok_Corcovado - AC Jobim.mscx
Nice finally I can work on. :D

However please make MS to handle these tags correctly (without crashing)
In C fixing checking for null pointers is always a good a idea. But beside for that since you can't handle check them all so use SEH via TRY CATCH blocks so the program runs on even after some null pointers exception.
Even without handler ;) - from the user point a silently passed skipped error is much more agreeable the a hard crash
Well for reference that's where it comes from:
Corcovado - AC Jobim.cap
I used CapellaScan 8 to read in the sheet.