From: Jean-Baptiste Mardelle Date: Mon, 28 Jun 2010 08:30:33 +0000 (+0000) Subject: Fix crash when dragging keyframe ouside clip on left / right border: X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=d47af1f131eef395efae12cf312429809f69385a;p=kdenlive Fix crash when dragging keyframe ouside clip on left / right border: http://www.kdenlive.org/mantis/view.php?id=1663 svn path=/trunk/kdenlive/; revision=4546 --- diff --git a/src/abstractclipitem.cpp b/src/abstractclipitem.cpp index cf9c60c3..8ddc3859 100644 --- a/src/abstractclipitem.cpp +++ b/src/abstractclipitem.cpp @@ -131,14 +131,13 @@ void AbstractClipItem::resizeStart(int posx, bool hasSizeLimit) if (durationDiff == GenTime()) return; //kDebug() << "-- RESCALE DIFF=" << durationDiff.frames(25) << ", CLIP: " << startPos().frames(25) << "-" << endPos().frames(25); - if (type() == AVWIDGET && hasSizeLimit && cropStart() + durationDiff < GenTime()) { - durationDiff = GenTime() - cropStart(); + if (type() == AVWIDGET && hasSizeLimit && (cropStart() + durationDiff < GenTime())) { + durationDiff = GenTime() - cropStart(); } else if (durationDiff >= cropDuration()) { return; if (cropDuration() > GenTime(3, m_fps)) durationDiff = GenTime(3, m_fps); else return; } - //kDebug()<<"// DURATION DIFF: "< start && newpos <= start) newpos = start + 1; + if (editedKeyFramePos() < end && newpos >= end) newpos = end - 1; newpos = qMax(newpos, start); newpos = qMin(newpos, end); diff --git a/src/customtrackview.cpp b/src/customtrackview.cpp index 7046d978..eab1a6fd 100644 --- a/src/customtrackview.cpp +++ b/src/customtrackview.cpp @@ -3270,11 +3270,12 @@ void CustomTrackView::mouseReleaseEvent(QMouseEvent * event) val = (br.bottom() - val) * maxh; int start = item->cropStart().frames(m_document->fps()); int end = (item->cropStart() + item->cropDuration()).frames(m_document->fps()) - 1; + if ((val < -50 || val > 150) && item->editedKeyFramePos() != start && item->editedKeyFramePos() != end) { //delete keyframe - kDebug() << "// DELETE KFR: " << item->editedKeyFramePos(); item->movedKeyframe(item->getEffectAt(item->selectedEffectIndex()), item->selectedKeyFramePos(), -1, 0); } else item->movedKeyframe(item->getEffectAt(item->selectedEffectIndex()), item->selectedKeyFramePos(), item->editedKeyFramePos(), item->editedKeyFrameValue()); + QDomElement newEffect = item->selectedEffect().cloneNode().toElement(); //item->updateKeyframeEffect(); //QString next = item->keyframes(item->selectedEffectIndex()); @@ -4288,10 +4289,10 @@ void CustomTrackView::updatePositionEffects(ClipItem * item, ItemInfo info) QDomElement oldeffect = item->effectAt(effectPos); int start = item->cropStart().frames(m_document->fps()); int max = start + item->cropDuration().frames(m_document->fps()); - if (start < 0) { - max -= start; - start = 0; - } + if (start < 0) { + max -= start; + start = 0; + } oldeffect.setAttribute("in", start); oldeffect.setAttribute("out", max); if (!m_document->renderer()->mltEditEffect(m_document->tracksCount() - item->track(), item->startPos(), item->getEffectArgs(oldeffect)))