Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #41506 : crash on paste if a chordrest with spanner would cross a ba... #1551

Merged
merged 1 commit into from Dec 20, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions libmscore/paste.cpp
Expand Up @@ -425,7 +425,7 @@ void Score::pasteChordRest(ChordRest* cr, int tick, const Interval& srcTranspose
bool firstpart = true;
while (rest) {
measure = tick2measure(tick);
Chord* c2 = static_cast<Chord*>(c->clone());
Chord* c2 = firstpart ? c : static_cast<Chord*>(c->clone());
int mlen = measure->tick() + measure->ticks() - tick;
int len = mlen > rest ? rest : mlen;
QList<TDuration> dl = toDurationList(Fraction::fromTicks(len), true);
Expand Down Expand Up @@ -462,8 +462,9 @@ void Score::pasteChordRest(ChordRest* cr, int tick, const Interval& srcTranspose
Rest* r = static_cast<Rest*>(cr);
Fraction rest = r->duration();

bool firstpart = true;
while (!rest.isZero()) {
Rest* r2 = static_cast<Rest*>(r->clone());
Rest* r2 = firstpart ? r : static_cast<Rest*>(r->clone());
measure = tick2measure(tick);
Fraction mlen = Fraction::fromTicks(measure->tick() + measure->ticks() - tick);
Fraction len = rest > mlen ? mlen : rest;
Expand All @@ -474,8 +475,8 @@ void Score::pasteChordRest(ChordRest* cr, int tick, const Interval& srcTranspose
undoAddCR(r2, measure, tick);
rest -= d.fraction();
tick += r2->actualTicks();
firstpart = false;
}
delete r;
}
else if (cr->type() == Element::Type::REPEAT_MEASURE) {
RepeatMeasure* rm = static_cast<RepeatMeasure*>(cr);
Expand Down