Crash when trying to attach an image to key signature

• Mar 5, 2021 - 14:43
Reported version
3.6
Type
Functional
Frequency
Once
Severity
S2 - Critical
Reproducibility
Always
Status
closed
Regression
No
Workaround
No
Project

Copy image from any image application to clipboard.
In MuseScore 3.6.2 select key signature.
Use CTRL+V to insert image.
Crash.
See also: https://musescore.org/en/node/318370


Comments

Severity S4 - Minor S2 - Critical

Crashes are Critical, per definition

In Debug mode it dies on a failed assertion, trying to convert the image to a keysig?

Fatal: ASSERT: "e == 0 || e->isKeySig()" in file ...\libmscore\scoreElement.h, line 520

Most element types ignore an attempt to paste an image onto them. Notable exceptions include notes, rests, and measures. The pasting of an image is implemented as a "drop", and since key signatures only accept a drop if the element being dropped is another key signature, then it naturally assumes that anything dropped onto it is a key signature. But the paste function bypasses the acceptDrop(EditData*) function in the element's subclass, and performs the drop unconditionally, which is, of course, incorrect. The solution would be to do something like this: https://github.com/mattmcclinch/MuseScore/commit/9d27b8c.

@odelphi231
No one ever said that MuseScore needs to allow this. My solution certainly does not allow images to be attached to a key signature, but rather prevents the drop from happening, considering that it is not allowed.

FWIW, though, I'd love to see more elements accept drops of images - also symbols or text. Could be a simple way to get custom displays of key or especially time signatures that go beyond what our customization facility might be designed to anticipate. Same for clefs. Not that long ago we started supporting ability to drop symbols on barlines and I've been taking advantage of that quite a bit. Hmm, really clefs, key signatures, time signatures, and I suppose breaths - that would cover pretty much all "top level" elements one might want to attach something to.

Fix version
4.0.0