Crash on entry of note while in "slur entry mode" on last note of score
Ubuntu Studio 14.04, GIT commit: 9ff125f
1) new score, 4/4
2) last measure, note entry
3) A B C D
4) S
5) C
Result: crash
Normally, if you are in note entry mode and hitting the end of the score, you can keep typing all you want and the notes you type just keep replacing the last note. But if you press "S" to start a slur while on the last note, then enter another note, it crashes. Interesting, "A S B C D C" does *not* crash - you again get the behavior where the last C just replaces the D.
Comments
Not just the last note of the piece. It's any situation where you are replacing the start note of the slur. Same thing happens if you enter a note, press S, enter more notes, then cursor back to the first note and re-enter it. Eg,
1) note entry in an empty 4/4 measure
2) C S D E F
3) Left Left Left to move cursor back to the C
4) B
The crash occurs in Score::setNoteRest() where we start accessing the start & end elements of _is->slur(). Because we are replacing the first note, it has actually been removed at this point, so the start element is null, and the code here is not checking for that. I propose fixing it by re-establishing the start element of the slur.= to be the newly entered note.
I might also question why we are bothering to allow S to work at all on the last note of the score. What it ends up doing is creating a slur from the last note to itself that you'll never see and probably not realize you've created. We should consider disallowing it, and it's pretty clear where this should happen - in cmdAddSlur(firstNote, lastNote) where cr2 is explicitly set to cr1 if there is no next element. But I guess that code is there for a reason, so I'll leave that for someone else to deal with. I just plan to fix the crash.
https://github.com/musescore/MuseScore/pull/1067
Turns out that hitting "S" on the last note of the score isn't *completely* useless. If after doing that, you hit Ctrl+B to add another measure, you can then continue adding notes, and the slur will extend normally. So I don't think we really do need to worry about disabling "S" while on the last note of the score after all. My PR fixes the crash for both the last note of the score and when cursoring back to the start of any slur, and I think that's that all that is actually needed.
Fixed in b5790f905b
Automatically closed -- issue fixed for 2 weeks with no activity.