Key signature disappears upon toggling "show courtesy" for both key sig and courtesy

• Dec 30, 2014 - 16:35
Type
Functional
Severity
S2 - Critical
Status
closed
Project

Ubuntu 14.04, GIT commit: 38ceee4

Tough to come up with a one-line description, but easy to reproduce:

1) new score, treble staff template, key of Eb (or from scratch, but add line break after measure 4)
2) drag D major key sig to measure 5
3) click the courtesy key sig at end of measure 4
4) turn off "show courtesy" via Inspector - nothing happens, but probably nothing should
5) click main key sig in measure 5
6) turn off "show courtesy" via Inspector

Result: key signature is lost; we now see Eb

The same thing happens even if you turn "show courtesy" back on after step 4 - that is, toggle it off then immediately on. As soon as you touch that option with a courtesy signature selected, bad things happen. You can also see another sign of this by right clicking the courtesy signature before and after step 4. Before you mess with the "show courtesy" option in Inspector, no "hide courtesy" option appears in context menu. But after touching that option, the "show courtesy" option appears and remains as you toggle. The Object Debugger shows the "Generated" flag is cleared the first time you touch the "show courtesy" option.

When running under the debugger, attempting to undo these operations to get back where you started crashes, an assert failure in Measure::remove() trying to remove a keysig segment. The code is in an #ifndef DEBUG" so I guess normal users wouldn't see a crash, but clearly, we are not in a good state.

The simple fix here would be to disable the "show courtesy" checkbox for courtesy key signatures. Better might be to make it work as the user probably expects - to act on the main key signature instead.


Comments

Actually, scratch the idea about howing the checkox work "as the user probably expects" - do we really want a checkbox in Inspector whose effect is to delete the object being inspected?

I'll implement the simple fix, then.

EDIT: hmm, we actually *do* the "expected" thing for clefs - unchecking the box with a courtesy clef selected makes the element go away, apparently (it is still available in Inspector and can be toggled back on). I also see time signatures have the same weirdness as key signatures in that toggling the "show courtesy" property on the courtesy time signature itself clears the "generated" flag, causing "show/hide courtesy" to become available in the context menu. I haven't seen any other bad effects from this, but it seems wrong too, so I plan to disable the checkbox for both courtesy keysignatures and courtesy timr signatures (or, perhaps, for "generated" ones) unless someone objects.