-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MU4] Fix #332925: Half duration shortcut crashes musescore when time signature is 5/4 #12084
Conversation
debe78b
to
dc2ed77
Compare
…ture is 5/4 Crash happens only in Debug builds. Backport of musescore#12084
Might no longer be needed, at least I can't reproduce the issue anymore? |
The assert is still in place though:
So it seems my testing is flawed, as for halfing a measure rest in 5/4 would never be an exact match (and indeed isn't, it gets turned into 3 rests, half, and half) |
…ture is 5/4 Crash happens only in Debug builds. Backport of musescore#12084
dc2ed77
to
3ff088f
Compare
5fe3115
to
a6ab6b3
Compare
Could this please get reviewed? It sits here since 11 months |
The change itself makes sense to me, but the resulting behaviour is maybe not entirely what I would expect. If I select a full measure rest in a 5/4 measure, then I'd expect it to be shortened to 4/4 first, and then to 2/4 (or 2/4 dotted when using Shift). But currently, it will immediately go from 5/4 to 2/4 (or 2/4 dotted). Fortunately, I don't think that needs to be difficult to implement: when |
I'm confused now... where exactly check what exactly? |
In For instance, if the time signature is 5/4, this will be truncated to a whole note (duration 4/4). Then, by So, the truncation needs to be detected, and that can be done by comparing the fraction of the truncated if (initialDuration.fraction() < cr->measure()->timesig()) {
// then the duration was already shortened by the truncation; don't shorten it again
} Of course, we should only do this when decrementing the duration; when incrementing it, the result is already correct. So I'd suggest to rewrite the surrounding code like this: TDuration initialDuration;
if (cr->durationType() == DurationType::V_MEASURE) {
initialDuration = TDuration(cr->measure()->timesig(), true);
if (initialDuration.fraction() < cr->measure()->timesig() && nSteps < 0) {
// Duration already shortened by truncation; shorten one step less
++nSteps;
}
} else {
initialDuration = _is.duration();
} Then you could add an optimisation for the case that |
a6ab6b3
to
737b14c
Compare
OK, done. |
Crash happens only in Debug builds. Backport of musescore#12084, improved version, the crash was fixed already in the earlier version.
@Jojo-Schmitz Sorry, turns out I was confused. Contrary to what I thought, positive nSteps represents decrementing (and that has to do with the order of the cases of the |
737b14c
to
8517c5d
Compare
Glad that not just I was confused ;-) |
…ture is 5/4 Crash happens only in Debug builds.
8517c5d
to
d618822
Compare
@abariska This is ready for testing! |
🟢 TESTED |
Crash happens only in Debug builds. Backport of musescore#12084, improved version, the crash was fixed already in the earlier version.
Crash happens only in Debug builds. Backport of musescore#12084, improved version, the crash was fixed already in the earlier version.
Crash happens only with Debug builds, not with Release or RelWithDebInfo builds, as those have asserts disabled.
Probably happens on any time sig, where the full measure rest is not having the same duration as a whole rest, and also does happen on "half dotted duration" as well as "double duration" and "double dotted duration".
Resolves: https://musescore.org/en/node/332925
Same issue and fix for MU3