Measure::cloneMeasure() appends too many staves to cloned measure
S4 - Minor
In beginning of cloneMeasure(), after creating a new Measure. The measure constructor already appends a number of staves based on the number of staves in the score passed to cloneMeasure():
int n = _score->nstaves();
But then right after that, cloneMeasure() unecessarily addes extra staves to the measure based on the number of staves in the measure that is being cloned
foreach(MStaff* ms, staves) m->staves.append(new MStaff(*ms));
But these extra staves are unecessary and a source of bugs.
Note that later when copying data for each tracks, it is only concerned with the number of staves in the dest score (not in the source measure).
For instance, if destination score to clone into has 2 staves, and input measure being cloned has 1 stave, then this code as is will erroneously produce 3 staves (2 staves by the measure constructor, then the additional stave), when resultant measure should only have 2 staves.
I'm going to replace
Note: we already take care of checking the staves in Score::appendScore():
So that hopefully that assert won't be hit...it acts more as a code comment.