Crash by selecting twice or once “all similar elements”, and in all the palettes.

• Nov 27, 2014 - 04:57
Type
Functional
Severity
S2 - Critical
Status
closed
Project

Nigthly, November 26 (609d22e) / Windows 7

1. « My First Score »

2. Drag and drop the Bass Clef in the second measure

3. Click-right on this Clef → « Select on similar elements »

Result : crash

clefs.jpg

All the content of all the palettes ( (except Beam Properties : no element in the score) are concerned.

Sometimes, an only selection of « all similar elements » leads to the crash, e.g. (so, Clefs), but also

Dynamics marks.

dynamics.jpg

- Usually you have to repeat the action twice (after have wanted e.g. moving the elements with Ctrl, but it is not necessary: just repeat the action twice is sufficient)

For example, with repeat twice :

Voltas:
volta twice.jpg

Tempo text:

tempo twice.jpg

- Crescendos (line palette):
crescendos twice.jpg

etc. etc. :(

Attachment Size
clefs.jpg 17.92 KB
dynamics.jpg 13.37 KB
volta twice.jpg 19.13 KB
tempo twice.jpg 13.74 KB
crescendos twice.jpg 20.08 KB

Comments

Thanks for finding steps to reproduce this! I've seen it too but hadn't quite figured out how to reproduce.

I looked at this, and while I canm clearly see the problem, I am not sure how to fix it.

The crash seems to stem from this change to make the various select similar commands work with keybaord shortcuts:

https://github.com/musescore/MuseScore/commit/93e1d5b737d277716d95159fe…

The problem is the Selection::element() only returns meaningful result for a single selection. It returns 0 if there are mutliple or no items selected. curElement has meaningful info if the element that was right clicked is not actually selected, but for whatever reason, it is not set if the right-clicked item is actually selected. I don't know if there is any way for the general command handler to get at the item that was right clicked; this might have to still be handled in the popup handler, while letting the general command handler deal with cases where the command is initiated by keyboard shortcut. And the general command handler probably needs to not bother calling selectSimilar if there is not a single selected item.

I would propose to make the shortcut ineffective if several elements are selected. I will push a fix.
Of course, right clicking would still work.

Huh, I hadn't realized that the popup handler would get called after the general command handler. So this does work - if the general handler can't deal with it on right click (because there was not a single selection), the popup handler steps in. It does mean the command actually gets handled twice in cases where there there was a single elemented selected and you initiated the command via the popup. But it does the same thing both cases, so it's probably harmless.