Skip to content

Commit

Permalink
fix #279609: keysig problems on insert/delete measures
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcSabatella authored and dmitrio95 committed Dec 16, 2018
1 parent e73421a commit 1dcbb7c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions libmscore/edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2684,7 +2684,7 @@ void Score::insertMeasure(ElementType type, MeasureBase* measure, bool createEmp
Measure* pm = mi->prevMeasure();
if (pm) {
Segment* ps = pm->findSegment(SegmentType::Clef, tick);
if (ps) {
if (ps && ps->enabled()) {
Element* pc = ps->element(staffIdx * VOICES);
if (pc) {
pcl.push_back(toClef(pc));
Expand All @@ -2695,7 +2695,7 @@ void Score::insertMeasure(ElementType type, MeasureBase* measure, bool createEmp
}
}
for (Segment* s = mi->first(); s && s->rtick() == 0; s = s->next()) {
if (s->isHeaderClefType())
if (s->isHeaderClefType() || !s->enabled())
continue;
Element* e = s->element(staffIdx * VOICES);
if (!e)
Expand Down Expand Up @@ -3461,6 +3461,7 @@ void Score::undoChangeKeySig(Staff* ostaff, int tick, KeySigEvent key)
continue;
}
Segment* s = measure->undoGetSegment(SegmentType::KeySig, tick);

int staffIdx = staff->idx();
int track = staffIdx * VOICES;
KeySig* ks = toKeySig(s->element(track));
Expand Down
2 changes: 1 addition & 1 deletion libmscore/undo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1586,7 +1586,7 @@ void InsertRemoveMeasures::insertMeasures()
fs = toMeasure(fm)->first();
ls = toMeasure(lm)->last();
for (Segment* s = fs; s && s != ls; s = s->next1()) {
if (!(s->segmentType() & (SegmentType::Clef | SegmentType::KeySig)))
if (!s->enabled() || !(s->segmentType() & (SegmentType::Clef | SegmentType::KeySig)))
continue;
for (int track = 0; track < score->ntracks(); track += VOICES) {
Element* e = s->element(track);
Expand Down

0 comments on commit 1dcbb7c

Please sign in to comment.