Crash when editing element without grips after editing element with grips

• Jan 20, 2015 - 15:01
Type
Functional
Severity
S2 - Critical
Status
closed
Project

Ubuntu 14.04, GIT commit: 74ba9fe

This morning I got a crash here:

https://github.com/musescore/MuseScore/blob/451668532a74550bd3ee11080b9…

I was hitting down arrow, I believe with a note selected although I wasn't intentionally in edit mode (I mus have double rather than single clicked something inadvertently), but I can't figure out how to reproduce. And unfortunately, I didn't stop to examine the state,

Looking at the code, I can only imagine curGrip was set to some value that isn't NO_GRIP but isn't valid either. We could perhaps prevent the crash by adding "&& curGrip < grips" to the line above, but I guess I have no way of knowing if curGrips was valid at that point either.


Comments

Got it to happen again, this time had the presence of mind to see what was happening before it was too late.

Here are steps to reproduce:

1) enter two beamed eighth notes
2) double click beam, make sure end grip is selected (should be by default)
3) Esc
4) now double click one of the notes
5) right arrow

Result: crash

curGrip is still set to 1 (Ms::END) left over from the beam edit, but grips is 0 (as I assume it should be, since a note has no grips).

You can get the same result by using a slur or other element with grips instead of a beam to trigger the setting of curGrip. You can also see it trying to nudge an articulation marking or other element that has no grips.

Ideally, I would think we should be resetting curGrip on endEdit for all elements that use grips, also maybe resetting it on startEdit for elements that don't, just to make sure there aren't other places where this is an issue.

But we can fix this crash by simply checking grips first as I suggested above.