Measure::cloneMeasure() appends too many staves to cloned measure
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).