Skip to content

Commit

Permalink
Merge pull request #11399 from RomanPudashkin/crash_when_adding_time_sig
Browse files Browse the repository at this point in the history
[MU4] Fix #11329: Сrash when adding a time signature to the part
  • Loading branch information
RomanPudashkin committed Apr 26, 2022
2 parents 207b121 + bf6857d commit 0eb4ed7
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
23 changes: 23 additions & 0 deletions src/engraving/libmscore/measure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2964,6 +2964,29 @@ const Measure* Measure::mmRest1() const
return 0;
}

int Measure::measureRepeatCount(staff_idx_t staffIdx) const
{
if (staffIdx >= m_mstaves.size()) {
return 0;
}

return m_mstaves[staffIdx]->measureRepeatCount();
}

void Measure::setMeasureRepeatCount(int n, int staffIdx)
{
if (staffIdx >= m_mstaves.size()) {
return;
}

m_mstaves[staffIdx]->setMeasureRepeatCount(n);
}

bool Measure::isMeasureRepeatGroup(staff_idx_t staffIdx) const
{
return measureRepeatCount(staffIdx) > 0;
}

//---------------------------------------------------------
// isMeasureRepeatGroupWithNextM
// true if this and next measure are part of same MeasureRepeat group
Expand Down
6 changes: 3 additions & 3 deletions src/engraving/libmscore/measure.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,9 @@ class Measure final : public MeasureBase
Measure* mmRestFirst() const;
Measure* mmRestLast() const;

int measureRepeatCount(staff_idx_t staffIdx) const { return m_mstaves[staffIdx]->measureRepeatCount(); }
void setMeasureRepeatCount(int n, int staffIdx) { m_mstaves[staffIdx]->setMeasureRepeatCount(n); }
bool isMeasureRepeatGroup(staff_idx_t staffIdx) const { return measureRepeatCount(staffIdx); } // alias for convenience
int measureRepeatCount(staff_idx_t staffIdx) const;
void setMeasureRepeatCount(int n, int staffIdx);
bool isMeasureRepeatGroup(staff_idx_t staffIdx) const;
bool isMeasureRepeatGroupWithNextM(int staffIdx) const;
bool isMeasureRepeatGroupWithPrevM(int staffIdx) const;
Measure* firstOfMeasureRepeatGroup(int staffIdx) const; // used to find beginning of group
Expand Down

0 comments on commit 0eb4ed7

Please sign in to comment.