Crash on right-click / Edit Element with a different element selected
1) default score
2) single-click a barline to select it
3) without deselecting the first barline, right-click a different barline, thus bringing up the content menu on the second barline even though the first is selected
4) Edit Element
Result: crash, in drawEditMode, dereferencing a null pointer.
We can test and avoid that particular crash, but there are other interesting bad effects (click a text element, right-click a rest, Edit Element - status bar will claim you're in text edit mode rather than edit mode). Root of the problem is that ScoreView::cmd() is calling startEditMode on the selected element, which is not what you right-clicked. Well, the real problem is probably that we are hitting ScoreView::cmd() at all, really we should be using the handler for edit-element in ScoreView::objectPopup(). I guess the command form is taking precedence. Not sure why or what the right fix is.
Comments
Actually, we are handling edit-element twice. The first time is when the action is triggered during popup.exec(). ScoreView::cmd() does not know that we want to handle the action in ScoreView::objectPopup(). It has no knowledge of the popup whatsoever. See https://github.com/musescore/MuseScore/pull/5153 for what I believe to be the right fix.
Fixed in branch master, commit ede7d2d7d6
fix #290967: Crash on right-click / Edit Element with a different element selected
Fixed in branch master, commit e1e3bb1324
_Merge pull request #5153 from mattmcclinch/290967-edit-element
fix #290967: Crash on right-click / Edit Element with a different element selected_
Fixed in branch 3.2, commit c18f5e1e7b
_Merge pull request #5153 from mattmcclinch/290967-edit-element
fix #290967: Crash on right-click / Edit Element with a different element selected_
Automatically closed -- issue fixed for 2 weeks with no activity.