Skip to content

Commit

Permalink
Fix corruption on enter note mid-second-voice with local time sig
Browse files Browse the repository at this point in the history
Resolves: #26001

Resolves the freeze that occurs when opening the corrupted file. Also resolves the problem which causes the corruption in the first place.
  • Loading branch information
mike-spa committed Jan 20, 2025
1 parent a360763 commit e151a25
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/engraving/dom/check.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,9 @@ void Measure::checkMeasure(staff_idx_t staffIdx, bool useGapRests)
LOGN("in measure underrun %6d at %d-%d track %zu", tick().ticks(),
(currentPos / stretch).ticks(), (expectedPos / stretch).ticks(), track);
fillGap(expectedPos, currentPos - expectedPos, track, stretch, useGapRests);
if (currentPos >= f) {
break;
}
}

DurationElement* de = cr;
Expand Down
5 changes: 3 additions & 2 deletions src/engraving/dom/cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -683,9 +683,10 @@ void Score::expandVoice(Segment* s, track_idx_t track)
//
Measure* m = s->measure();
Fraction stick = ps ? ps->tick() : m->tick();
Fraction stretch = staff(track2staff(track))->timeStretch(stick);
Fraction ticks = s->tick() - stick;
if (ticks.isNotZero()) {
setRest(stick, track, ticks, false, 0);
setRest(stick, track, ticks * stretch, false, 0);
}

//
Expand All @@ -701,7 +702,7 @@ void Score::expandVoice(Segment* s, track_idx_t track)
if (ticks == m->ticks()) {
addRest(s, track, TDuration(DurationType::V_MEASURE), 0);
} else {
setRest(s->tick(), track, ticks, false, 0);
setRest(s->tick(), track, ticks * stretch, false, 0);
}
}

Expand Down

0 comments on commit e151a25

Please sign in to comment.