Slur saved wrong when from low staff to second voice; crash on paste

• Mar 14, 2015 - 16:36
bug report

2.0 RC.
There was an old bug where, going from a lower staff to one above, the slur didn't anchored at all to the top staff. That is now solved, but in the case where the top staff has two simultaneous voices, it anchors to the wrong one.

Original thread:


Title Slur saved wrong when from low staff to second voice Slur saved wrong when from low staff to second voice; crash on paste
Priority normal critical

There is also a crash on copy/paste of this slur. Could be a separate issue, but looking at the code, I think these need to be dealt with together.

Here are steps to reproduce the crash:

1) load attached score
2) ctrl+click the first note ("G") of measure 1 and the voice 2 "A" in measure 2
3) press "S"
4) select measures 1-2, both staves
5) copy
6) click measure 5, top staff
7) paste

Result: crash. If you repeat this process but use the voice 1 "A" instead of voice 2, there is no crash, but the slur is not connected properly, either.

The original problem with the slur moving to the wrong voice on read is easily fixed, I think. We just need track() instead of e.track() here:…

Might also work to not bother worrying about the track of the slur stop element at all, and just going with the track2 value recorded in the slur start element. But that seems a riskier change, given that I don't really know all the different cases that this code is designed to handle.

The copy/paste problems, I think, come from the fact that we aren't processing the SpannerValues that we recorded when saw the slur stop. That happens only in Measure::read(), but that code doesn't get hit during a paste. So we don't get a reasonable end element. The crash happens because of code in updateSelectedElements that is not handling this.

Hopefully I'll be able to sort all this out and have a fix. If nothing else, I should be able to fix the original problem on read, and also prevent the crash.

Attachment Size
cross-staff-slur.mscx 7.87 KB