Wandering hairpin in score with mmrest & invisible staves

• Sep 7, 2017 - 22:17
Reported version
2.1
Type
Functional
Severity
S2 - Critical
Status
closed
Regression
No
Workaround
No
Project

Another trigger for a "wandering hairpin", still present in 2.1. To reproduce:

1) load attached score
2) change vertical offset of hairpin
3) save
4) close
5) reload

Result: horizontal offset has changed as well

Depending on the content of the score, it can be a very big discrepancy - like half way across the page.

The trigger seems to be a combination of mmrests and invisible staves, but it also seems to be somewhat dependent on the order in which things happen, because I wasn't always able to reproduce this from scratch. But whatever has infected this particular score appears to be permanent. And same for the score posted in the forum that led to this issue being filed: https://musescore.org/en/node/88321#comment-780041. In my response there, I indicated the hairpin was actually attached to the wrong staff, and this is true - unhide the piano staff and check out the hairpins again. But it does't seem to be the case with my test score. Still, the presence of the invisible staff seems necessary to reproduce the problem, so it's somehow relevant.

Attachment Size
hairpin-wrong-staff - saved.mscx 12.15 KB

Comments

This issue goes back more than three years, ie on July 28, 2014

Tested with always the same sequence of steps, ie :

1) New score for a piano (one staff) and another (two staves), 5 measures
2) Enter two half notes: measure 3 top staff, and second staff
3) Add a hairpin: top staff on half note
4) « M »
5) « I » → Untick « Visible » for second piano
6) Hairpin : set Vertical offset to 1,00
7) Save/Close

  • After reload, I get this result with this nigthly, so, as expected : 69923ea

    699 2014.jpg

  • I receive an unexpected/wrong result - for horizontal offset - with the next nigthly : cca0251
    ccao 2014.jpg

  • So, I guess it’s a side effect of this last mentioned nightly/commit : cca0251

To fix : #27861: Saving score with some instruments suppressed and multimeasure rests messes up score

Attachment Size
699 2014.jpg 9.47 KB
ccao 2014.jpg 10.47 KB

Brilliant, thanks as always for the investigation!

If I understand the code correctly, it appears that when saving a score with mmrests and invisible staves, we actually temporarily set the staves to visible before writing the file, in order to be sure all necessary layout information is present. I have my doubts about whether that was the best solution to the original problem in #27861: Saving score with some instruments suppressed and multimeasure rests messes up score. But in any case, the problem appears to be that when we read the file back in, we are getting the hairpin position based on where it would be if the invisible staves were visible, because that's how it was saved. I suspect that how we are saving the file is OK but we need to be more clever on reading it, to adjust the position. But maybe not - maybe we need to look more closely at how we are saving it. Anyhow, knowing the root cause will help greatly, so thanks again!