Skip to content

Commit

Permalink
Merge pull request #12084 from Jojo-Schmitz/cmdIncDecDuration
Browse files Browse the repository at this point in the history
[MU4] Fix #332925: Half duration shortcut crashes musescore when time signature is 5/4
  • Loading branch information
cbjeukendrup authored May 23, 2023
2 parents b4dba9d + d618822 commit f3ce3c9
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/engraving/libmscore/cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2900,9 +2900,18 @@ void Score::cmdIncDecDuration(int nSteps, bool stepDotted)

// if measure rest is selected as input, then the correct initialDuration will be the
// duration of the measure's time signature, else is just the input state's duration
TDuration initialDuration
= (cr->durationType() == DurationType::V_MEASURE) ? TDuration(cr->measure()->timesig()) : _is.duration();
TDuration d = initialDuration.shiftRetainDots(nSteps, stepDotted);
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();
}
TDuration d = (nSteps != 0) ? initialDuration.shiftRetainDots(nSteps, stepDotted) : initialDuration;
if (!d.isValid()) {
return;
}
Expand Down

0 comments on commit f3ce3c9

Please sign in to comment.