Don't allow more than one staff type change per measure
1) create a new score
2) add lots of staff type changes to the same measure
3) watch the program eventually crash
I imagine that the solution would be to not let the user add more than a staff type change to a measure.
I think the best way to implement this is to make a emergent window appear telling the user that she/he is trying to do that, with the next options (using a better wording): 1. don't put the newly selected staff type changed; 2. replace the old staff type change by the new one (useful when you have more than one type in a pallete); 3. same as 2 and don't ask again.