[branch 1.2] Crash on copying note with Harmony (Ctrl-K) across scores with different number of staves

• Jan 12, 2012 - 20:42
S2 - Critical

Setup: SVN rev. 5215; compiled with latest Qt SDK (Qt Creator 2.4, Qt lib 4.7.4) under Windows XP SP3.

1) open any score with some harmony (Ctrl-K) as source (a very simple source score with just 1 Harmony text (figured bass) is attached)
2) open any score as destination (a very simple destination score is attached)
3) select the measure containing the harmony text in the source score
4) paste into the destination score.

If the source stave has an index greater than the number of staves in the dest. score, the program crashes. In the attached examples, copying goes from the 2nd stave of source score into a score which has only 1 stave.


crash happens in function Score::pasteStaff(QDomElement, ChordRest*) (file cmd.cpp, line 2646), because in the statement:

Part* partSrc = staff(srcStaffIdx)->part();

the source part is looked for in destination score and the latter does not have as many parts. This looking for source elements in the destination score is rather difficult to understand.




I believe the code after line 2646 should be run only if the destination score and the source score are the same... But I don't think there is a way to know this at this place. The goal is to be able to copy paste harmonies between instruments with transposition.

So we can avoid the crash by testing the limit but the real solution would be to carry the transposition in the pasted data...

Any thoughts ?