Select a note/rest before change the measure duration leads to corruption/crash

• Nov 2, 2016 - 19:48
Reported version
2.1
Type
Functional
Severity
S2 - Critical
Status
closed
Project

2.0.3 Version 3c7a69d, and current Nightly 5248e08/ Windows7

First reported: https://musescore.org/en/node/139651

1) "My First Score"
2) Select the whole rest, first measure, and type on 5 (so, the first quarter rest is hightlighted)
Result:
1) rest selected.jpg
3) Right-click on the measure -> Measure Properties -> Change "Actual Measure duration": eg 1/4 -> Ok

4) Type two notes (eg two E)

Result: corruption
résultat 1 de la corruption.jpg
5) Undo twice (more "visible" corruption)
résultat 2 de la corruption.jpg

- To get a crash:

On any score, eg this test file: test file measure duration.mscz
1) Select a quarter note (regardless of which: the first, third etc.) in the first measure
2) Right-click on this measure -> Measure Properties -> Change "Actual Measure Duration" to 1/4 -> Ok
3) Type a note
Result: crash
crash on any score.jpg


Comments

The crash is due to a failed assertion:
Fatal: ASSERT: "rtick2 > rtick1" in file ...\MuseScore\libmscore\sig.cpp, line 178 (:0, )

Immediatelly prior to that I see the following debug output:

Debug: segment not found (...\MuseScore\libmscore\measure.cpp:312, Ms::AccidentalVal Ms::Measure::findAccidental(Ms::Segment*, int, int, bool&) const)
Debug: Segment::add(Rest) there is already a Chord at 2:0:0(480) track 0. score 0x22916990 (...\MuseScore\libmscore\segment.cpp:423, void Ms::Segment::checkElement(Ms::Element*, int))
Debug: toDurationList:: rest remains -1/2 (...\MuseScore\libmscore\durationtype.cpp:485, std::vector Ms::toDurationList(Ms::Fraction, bool, int, bool))

I locate a change of behavior in October, 4, 2014 .

Ie: with this nigthly: 28893f9 at the end of the step #3 (ie, change duration measure -> Ok), the single action to press Ok un-selects (no highlighted) the rest/note.
unselect 4 octobre.jpg
So, then, by typing notes: no issue:
3)no issue.jpg

- With this one: a614472, one can observe the current behavior, ie, at the end of the step #3, the rest/note remains selected, and so with the consequences of corruption already described (see second image, first post)
4 octobre a6.jpg

Here is the stack trace (omitting the first steps calling Qt assert functions):
[...]
#4 0x0000000003b3e6c4 in Ms::TimeSigFrac::strongestSubbeatLevelInRange (this=0x7fffffff8fe0, rtick1=960, rtick2=481, subbeatTick=0x7fffffff8cc0)
at /home/antonio/MuseScore/libmscore/sig.cpp:178
#5 0x000000000302b299 in Ms::populateRhythmicList (dList=0x7fffffff9100, l=..., isRest=false, rtickStart=960, nominal=..., maxDots=1)
at /home/antonio/MuseScore/libmscore/durationtype.cpp:530
#6 0x000000000302af67 in Ms::toRhythmicDurationList (l=..., isRest=false, rtickStart=960, nominal=..., msr=0x6130001f0940, maxDots=1)
at /home/antonio/MuseScore/libmscore/durationtype.cpp:510
#7 0x0000000003aa3b15 in Ms::Score::setNoteRest (this=0x61b00005b080, segment=0x613000152880, track=0, nval=..., sd=..., stemDirection=...)
at /home/antonio/MuseScore/libmscore/cmd.cpp:581
#8 0x000000000306a3e0 in Ms::Score::putNote (this=0x61b00005b080, p=..., replace=true, insert=false) at /home/antonio/MuseScore/libmscore/edit.cpp:1369
#9 0x000000000305d57e in Ms::Score::cmdAddPitch (this=0x61b00005b080, step=35, addFlag=false, insert=false) at /home/antonio/MuseScore/libmscore/edit.cpp:945
#10 0x0000000000ceacb4 in Ms::ScoreView::cmdAddPitch (this=0x6170000a8e80, note=0, addFlag=false, insert=false) at /home/antonio/MuseScore/mscore/scoreview.cpp:5485
#11 0x0000000000c654e0 in Ms::ScoreView::cmd (this=0x6170000a8e80, a=0x602000184fd0) at /home/antonio/MuseScore/mscore/scoreview.cpp:2821

Here is what I found: the problem is that at #7 in Ms::Score::setNoteRest, a fraction -1/4 is used as input of Ms::toRhythmicDurationList. This apparently comes from the output of function makeGap at line 572 of cmd.cpp.
Sorry that I could not go deeper into the analysis.

Ciao,
ABL