[trunk] Copy n' Paste of notes 'forgets' some rests

• May 8, 2011 - 20:01
S4 - Minor

Setup: Ubuntu 11.04, Qt SDK 1.1 (Qt lib 4.7.3), but the issue occurs also under other OSes.


1) Open the attached sample score
2) Select and copy (^C) the whole Flute part
3) Select the first Violin measure
4) Paste (^P) the copied notes into the Violin part


1) The 2 semibreve rests are not there (the amount of note pasted is one measure less than the original)
2) The last measure of the Violin part is 'no-man-land': not even rests are there.


Attachment Size
trunk_note_copy_paste.mscz 1.72 KB


Initially, I converted the first half of the rest to two half notes, leaving a whole rest to follow, but the copy/paste still failed. Then I tried again (reloading MS and the score). I converted _all_ the whole rests to half rests and copy/paste worked fine. Seems like there's a bug with the whole rest, at least in this time signature because using 4/4 seemed to work OK.

However, as I created notes and then would undo and try different combinations, MS would simply crash unexpectedly, several times, doing different operations.

Status (old) active patch (code needs review)

Thanks for the replies.

I think I found the culprit: it is in function ChordRest::readProperties() (file chordrest.cpp), when a tag "durationType" is read back (lines 367-387 of current revision) from the DOM clipboard data to be pasted.

The function expects rests to be initialized as when they are read from a file, which is not the case for data 'written' to the clipboard.

The attached patch takes into account this special case. I have added some longish comments trying to explain the rationale behind the code. I tested it by copying and pasting long passages (hundreds of measures) and it seems to work.

However, this point of the function is becoming rather involved; perhaps, a different approach would be better; however this is not a change I feel confident to attempt on code I am not completely familiar with.

Hoping it is useful,


Sorry to pester, but:


I know there are more interesting new features brewing in the cauldron, but this is one of the two main points currently stopping trunk code from being really usable (at least for me, the other is this one )...



Status (old) patch (code needs review) fixed

patch applied in r4345. The current implementation is still limited and i am considering to redo it.