Corruption on operations involving measures with local time signature and modified actual duration
Windows 10, GIT commit: 3c7a69d
Discovered while working on #188051: Regression: Removing the content of measures after deletion of the time signature causes corruption/crash. The original problem did not affect 2.0.3, nor did the problem described in https://musescore.org/en/node/188051#comment-700151. However, I *can* get corruption for the same basic reasons in a measure whose actual duration differs from nominal *and* there is a local time signature involved:
1) new score for flute & oboe, 4/4
2) add local 3/4 signature to first measure of oboe part
3) change actual duration of measure 3 to 6/4
4) press Delete (with measure 3 still selected)
Result: corruption
But you can also get other corruptions from this combination with other operations that don't invovle deleting the content of the measure. For example, repeat steps 1-3 above, then try the following:
4) enter a dotted whole note into oboe part, measure 3
That shouldn't really be possible, the time stretch should have converted this measure into 4.5 beats. So it's already corrupt in a way. It gets worse:
5) select the dotted whole note, press 7 to change to a whole note
Now you have a the 4.5 beats I expect in measure 3, but measure 4 is corrupt.
Probably best for now to disallow this combination, as there are probably any number of other things that will go wrong that would each need to be corrected.
Comments
Actually, there is a pretty good chance that if we could make these measures have the proper rest(s) to start with, things might actually work well. And due to the way this is all implemented, that might turn out to be easier than detecting the local time signature and disallowing the operation. I'm looking into this.
Here is a PR that attempts to fix the problem directly. Can't guarantee everything will work, but it does seem to set things to a good start.
https://github.com/musescore/MuseScore/pull/3152
Not sure this is worth merging for 2.1 - it carries some risk, and local time signatures will still be pretty limited and corruption-prone.
Fixed in branch 2.2, commit 881beecaba
fix #189741: corruption on change duration with local timesig
To be tested in master.
Cannot reproduce. Behavior seems correct with both scenarios.
Please, reopen if corruption is here. If so, could you please attach the gif or screenshots or mscz with corrupted score?
Tested with MuseScoreNightly-2018-03-30-2123-master-b92a6e0.dmg (MacOS)
Automatically closed -- issue fixed for 2 weeks with no activity.
Bug definitely still exists. The key is to add a local time signature to the oboe staff only - meaning, hold Ctrl while adding it, so it affects only that staff. Here are the steps to demonstrate clearly:
1) new score, flute & oboe
2) add local time signature (hold ctrl) to measure 1, oboe staff
3) right click measure 3, either staff
4) change actual duration to 6/4
At this point, it's already possibly corrupt - the oboe staff is showing 6 beats when it should (because of the time stretch of the local time signature) be showing only 4.5. To make the corruption more apparent:
5) select measure 3, oboe staff
6) press Delete - now it shows only 3 beats, which is also wrong
7) enter a dotted half note into that measure
However, when fixing, keep #274659: Crash when changing measure duration in part in mind ;-)
:-)
This code is pretty much the same between 2.x and master, so I'm apply the same fix (including the fix to my fix) and assuming all is well, PR will be forthcoming.
We'll need my fix for #188051: Regression: Removing the content of measures after deletion of the time signature causes corruption/crash as well - that was what caused me to discover the current bug in the first place, and that fix also was only merged for 2.x (how common is that? should we be worried?)
Looking at getting them both going in one PR, separate commits.
https://github.com/musescore/MuseScore/pull/3834
BTW, I can get a crash in this same scenario even with my fix applied (for both 2.x and master) if, after the change in duration that results in the oboe part having a measure of duration 4.5 beats, I try to enter a double whole note into that measure. The code trying to split that up into ties just can't deal. It works fine in a "normal" 9/8 bar, so it's something about local timesigs throwing off that calculation. I don't think this means my fix here isn't good, just that it allows use to get far enough to find additional ways of breaking local timesigs :-)
Will file issue once I understand more about cause, probably tomorrow.
Fixed in branch master, commit 813b479d13
fix #189741: corruption on change duration with local timesig
Automatically closed -- issue fixed for 2 weeks with no activity.