Skip to content

Commit

Permalink
Merge pull request #5055 from jthistle/289531-crash-haripin
Browse files Browse the repository at this point in the history
fix #289531: deleting first measure causes crash when a hairpin starts there
  • Loading branch information
anatoly-os committed May 22, 2019
2 parents 46b79f3 + fe2cda1 commit 8dfcd62
Showing 1 changed file with 27 additions and 25 deletions.
52 changes: 27 additions & 25 deletions libmscore/rendermidi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1015,36 +1015,38 @@ void Score::updateHairpin(Hairpin* h)
{
Staff* st = h->staff();
Fraction tick = h->tick();
Segment* seg = h->startSegment();

// Find any changing dynamics
// If there are any, then start the hairpin from after them
for (Element* e : seg->annotations()) {
if (!e)
continue;
if (!e->isDynamic())
continue;
Dynamic* d = toDynamic(e);
if (d->changeInVelocity() == 0)
continue;
Segment* seg = h->startSegment();
if (seg) {
for (Element* e : seg->annotations()) {
if (!e)
continue;
if (!e->isDynamic())
continue;
Dynamic* d = toDynamic(e);
if (d->changeInVelocity() == 0)
continue;

switch (d->dynRange()) {
case Dynamic::Range::STAFF:
if (d->staff()->idx() != st->idx())
continue;
break;
case Dynamic::Range::PART:
if (d->part() != h->part())
continue;
break;
case Dynamic::Range::SYSTEM:
default:
break;
}
switch (d->dynRange()) {
case Dynamic::Range::STAFF:
if (d->staff()->idx() != st->idx())
continue;
break;
case Dynamic::Range::PART:
if (d->part() != h->part())
continue;
break;
case Dynamic::Range::SYSTEM:
default:
break;
}

// start hairpin after the dynamic stops
tick = seg->tick() + d->velocityChangeLength();
break;
// start hairpin after the dynamic stops
tick = seg->tick() + d->velocityChangeLength();
break;
}
}

int velo = st->velocities().velo(tick.ticks());
Expand Down

0 comments on commit 8dfcd62

Please sign in to comment.