Slur attaches to note in wrong voice after save/load

• Jan 12, 2014 - 03:00
Type
Functional
Severity
S4 - Minor
Status
closed
Project

Windows 7, GIT commit: 2902cf6

1) open the following score (created in 1.3, but same results if you recreate from scratch)
2) click "A" (voice 2), press "S" to add a slur (should connect to the G in voice 2)
3) save
4) reload

Result: the slur now connects to the "E" in voice 1


Comments

Status (old) fixed active

I'm still seeing this behavior, using the original file and steps as well as any other score. But I did think the fix was in at one time. Did a subsequent change break this, I wonder?

FWIW, the culprit seems to be this:

https://github.com/musescore/MuseScore/blob/eea5982cc5676405c634ab36925…

At this point in the code, e->track() is still voice "1" (0) for the staff - we haven't read the actual track tag. As a result, track2 is set to that same voice. If we actually have a voice "2" (1) slur, we get a track tag that sets the track member for the object to voice "2" (1), but track2 is still left set to voice "1".

If I remove this one line of code, leaving everything else the same, then track2 remains at its default of -1 until the end of the function, at which point track gets copied to track2. This seems to give the correct result. I haven't tested it super thoroughly, but removing this line does seems to fix voice 2 slurs in 2.0 scores, and it doesn't seem to break voice 2 slurs in 1.X files nor does it break cross voice slurs in either 1.X or 2.0 scores.

MarkRS - since you know this code better than I, I'd love it if you would take a look and verify this and see if I'm missing something. If you feel like submitting a PR - either just removing this line, or doing whatever else you feel necessary - great; otherwise I am happy to do it.

BTW, I don't know what other issues might be involved with reading slurs from 1.X files, but usually the best place to do special casing for 1.X files is in read114.cpp. The goal of that code is to tidy up 1.X scores to resemble 2.0 scores as much as possible, so there doesn't need to be so much special casing elsewhere.