Segment-attached element in Voice 2 causes corruption in Voice 1 on copy and paste

• Apr 24, 2015 - 21:46
Type
Functional
Severity
S2 - Critical
Status
closed
Project

To reproduce, enter a few notes in Voice 1 and a few notes in Voice 2 in the same measure. Attach a dynamic to one of the notes in Voice 2. Copy the whole measure and paste it anywhere. In the result, whatever note in Voice 1 began at the same point as the note in Voice 2 with the dynamic will be gone, leaving Voice 1 incomplete.


Comments

Confirmed - good catch!

Seems to be true for staff text as well, as well as a few other element types. Issue is here:

https://github.com/musescore/MuseScore/blob/7d70645725c9392309ee8d9684a…

For one thing, I believe that should be an undoAddElement(), not undoChangeElement. As it is, we are literally changing the voice 1 note into a dynamic marking rather than *adding* the dynamic marking.

But even if I make this change, the corruption is gone, but we lose the voice information - the newly added dynamic ends up in voice 1 rather than 2. So I think the setTrack() call above is not quite right either.

The undoChangeElement() call *was* formerly undoAddElement(). It was changed here:

https://github.com/musescore/MuseScore/commit/db9562f239a927f6e108ce201…

I *think* I understand the basic reasoning of the commit in general, and if so, then I believe this particular line was changed in error. The other calls to undoAddElement that were changed involved elements in their own segment types - clefs within clef segments, breaths in breath segments. But here, we are talking about elements that are normally in ChordRest segments, and we don't want to change a chord into something else.

As for the voice issue, it seems that code was added for figured bass, and I also get the basic reason for that change. I think we just need to add the original voice offset back in.

I'll do some testing and submit a PR soon. Would definitely appreciate a second set of eyes to review it to see if my understanding and fix is really correct.

I have been trying to narrow down an issue I have with a score I created in MS 1.3. (Which I belive is related to this one.)

Try to copy measure 1 in the score attached and paste it somewhere. ALL voices in beat 1 disappears! Not only voice 1.

However I cannot figure out how I made the score in MS 1.3. If I start from scratch in MS 1.3 I only get one note missing in voice 1. Same behaviour as described above.

Attachment Size
textcopy.mscz 7.57 KB

As far as I can see, all of the notes *are* in voice 1. Click a note, see what the status bar or the voice icons in the note input toolbar say. You have colored them all differently, but they are in the same chord in voice 1. The text, however, is voice 3. So yes, this appears to be another example of the exact same bug.