Crash when adding new time signature in the measure of a clef change
Reported version
3.0
Priority
P0 - Critical
Type
Functional
Frequency
Many
Severity
S2 - Critical
Reproducibility
Always
Status
closed
Regression
No
Workaround
No
Project
OS: Windows 10 (10.0), Arch.: x86_64, MuseScore version (64-bit): 3.0.0.4838, revision: a1152b9
Steps:
1) Create new score for at least two instruments (necessary condition)
2) Insert a new clef in first staff let's say measure 3
3) Insert a new time signature in the same measure 3
Result: crash
See:
Fix version
3.0.1
Comments
Verified that also happens for single instrument with multiple staves (example piano grand staff score).
Crash occurs in line 1588 of undo.cpp in
std::vector InsertRemoveMeasures::getCourtesyClefs(Measure* m)
for call toclef->isClef()
Call stack for reference:
For reference that above call stack was from a grand-staff single-instrument. Below is from two single-staff instruments:
They are identical call stacks.
In both cases I was inserting to meas 3 first staff first a bass clef then a 3/4 time sig.
In InsertRemoveMeasures::getCourtesyClefs(), the value of st is 1 when the crash occurs.
So it seems pretty simple. The code is assuming that every staff has a clef change. But that assumption is wrong if there aren't clef changes on every staff. That is why clef is null. And that is why should do
if (clef && clef->isClef())
instead ofif (clef->isClef())
https://github.com/musescore/MuseScore/pull/4517
When will the next version be released?
I've been told there would be 'frequent' updates, but I don't know what the exact schedule would be...
Fixed in branch master, commit 641ac7ad25
fix #280814 add timesig to meas w/some clefs
Fixes a crash when adding a timesig to a measure that has at least one clef but where not all staves have clef for that measure. Crash was result of a NULL defreference on the first staff that didn't have a clef in that clef segment.
Fix is simple to make sure to test that clef is non-NULL before dereferencing it.
Fixed in branch master, commit a9cdbed255
Merge pull request #4517 from ericfont/280814-add-timesig-meas-with-clef-but-not-all-staves-have-clefs
fix #280814 add timesig to meas w/some clefs
Automatically closed -- issue fixed for 2 weeks with no activity.