Skip to content

Commit

Permalink
Merge pull request #137 from lasconic/19076-crashline
Browse files Browse the repository at this point in the history
fix #19076: Crash when copying and pasting range with lines
  • Loading branch information
lasconic committed Dec 3, 2012
2 parents e04dc04 + bb1ab2f commit 53eab23
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions libmscore/paste.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,7 @@ void Score::pasteStaff(const QDomElement& de, ChordRest* dst)
{
beams.clear();
spanner.clear();
// QList<Tuplet*> invalidTuplets;

QMap<int, Spanner*> localSpanner;
for (Segment* s = firstMeasure()->first(Segment::SegChordRest); s; s = s->next1(Segment::SegChordRest)) {
foreach(Spanner* e, s->spannerFor())
e->setId(-1);
Expand Down Expand Up @@ -285,17 +284,19 @@ qDebug("cannot make gap in staff %d at tick %d", staffIdx, dst->tick());
Segment* segment = m->undoGetSegment(Segment::SegChordRest, tick);
sp->setStartElement(segment);
sp->setParent(segment);
undoAddElement(sp);
localSpanner.insert(sp->id(), sp);
}
else if (tag == "endSpanner") {
int id = eee.attribute("id").toInt();
Spanner* e = findSpanner(id);
Spanner* e = localSpanner.value(id, 0);
if (e) {
localSpanner.remove(id);
int tick = curTick - tickStart + dstTick;
Measure* m = tick2measure(tick);
Segment* seg = m->undoGetSegment(Segment::SegChordRest, tick);
e->setEndElement(seg);
seg->addSpannerBack(e);
undoAddElement(e);
if (e->type() == Element::OTTAVA) {
Ottava* o = static_cast<Ottava*>(e);
int shift = o->pitchShift();
Expand Down

0 comments on commit 53eab23

Please sign in to comment.