Skip to content

Commit

Permalink
fix #140081: Repeatedly deleting displaced beams causes crash
Browse files Browse the repository at this point in the history
  • Loading branch information
lasconic committed Nov 8, 2016
1 parent 461d30b commit 977d948
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions libmscore/beam.cpp
Expand Up @@ -2155,24 +2155,25 @@ void Beam::updateGrips(Grip* defaultGrip, QVector<QRectF>& grip) const
int idx = (_direction == Direction::AUTO || _direction == Direction::DOWN) ? 0 : 1;
BeamFragment* f = fragments[editFragment];

Chord* c1 = nullptr;
Chord* c2 = nullptr;
ChordRest* c1 = nullptr;
ChordRest* c2 = nullptr;
int n = _elements.size();
for (int i = 0; i < n; ++i) {
if (_elements[i]->type() == Element::Type::CHORD) {
c1 = static_cast<Chord*>(_elements[i]);
if (_elements[i]->isChordRest1()) {
c1 = static_cast<ChordRest*>(_elements[i]);
break;
}
}
for (int i = n-1; i >= 0; --i) {
if (_elements[i]->type() == Element::Type::CHORD) {
c2 = static_cast<Chord*>(_elements[i]);
if (_elements[i]->isChordRest1()) {
c2 = static_cast<ChordRest*>(_elements[i]);
break;
}
}

int y = pagePos().y();
grip[0].translate(QPointF(c1->stemPosX()+c1->pageX(), f->py1[idx] + y));
grip[1].translate(QPointF(c2->stemPosX()+c2->pageX(), f->py2[idx] + y));
grip[0].translate(QPointF(c1->stemPosX() + c1->pageX(), f->py1[idx] + y));
grip[1].translate(QPointF(c2->stemPosX() + c2->pageX(), f->py2[idx] + y));
}

//---------------------------------------------------------
Expand Down

0 comments on commit 977d948

Please sign in to comment.