Dragging key signature from custom palette to score leads to crash

• Mar 14, 2019 - 02:37
Reported version
P1 - High
S2 - Critical

Create a custom workspace that includes the Atonal key signature.
Drag the Atonal key signature to the score

Result - crash with no warning.

Note: double clicking to add key signature does not cause a crash, but cannot be used to set key signature in a single staff as is the most common use. Adding this from the advanced palette does not cause a crash, which can be applied to a single staff.


Title Dragging atonal key signature from custom palette to score leads to crash Dragging key signature from custom palette to score leads to crash

Took me a minute to figure out how to reproduce. It's doesn't happen with the key signature already on the palette (custom or not), only a key signature added to the palette from the master palette. So you'd have to have started with the basic palette and then added the atonal keysig, I guess. Although the bug isn't just with the atonal key sig - it actually applies to any of the predefined keysigs on the master palette. Drag one to a custom palette then to your score, crash.

BTW, you can add a keysig to a single staff via double-click, just hold Ctrl same as you would while dragging.

Cause of crash appears to be that the keysig is set to track 0 during the drag, rather than -1 as it should be since it does not yet belong to a staff. This is actually a problem for custom keysigs too but doesn't lead to a crash because we don't try to do anything with the staff info for a custom keysig, whereas for normal keysigs (including atonal ones) we look at the staff to know the clef so we can figure out how to lay out the keysig.

Looking at the palette file itself, I see the track 0 tag right there, so the palette itself is the problem. That is, th bug is more about the creation of the palette than the dragging from it. But we should try to fix it even for already-created palettes.

Actually, track 0 tags are common throughout the palette but they don't cause problems during drag & drop, I think because we usually check parent() first to see if the element is actually added to the score yet. So probably that's the fix here too.