Commit 884ad0a2 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Fix crash on resize after recent group resize fix

parent 62b260d7
Pipeline #3556 passed with stage
in 18 minutes and 56 seconds
...@@ -1581,17 +1581,17 @@ void TimelineModel::processGroupResize(QVariantList startPos, QVariantList endPo ...@@ -1581,17 +1581,17 @@ void TimelineModel::processGroupResize(QVariantList startPos, QVariantList endPo
bool result = true; bool result = true;
while (i.hasNext()) { while (i.hasNext()) {
i.next(); i.next();
QPair<int,int> startPos = i.value(); QPair<int,int> startItemPos = i.value();
QPair<int,int> endPos = endData.value(i.key()); QPair<int,int> endItemPos = endData.value(i.key());
if (startPos.first != endPos.first || startPos.second != endPos.second) { if (startItemPos.first != endItemPos.first || startItemPos.second != endItemPos.second) {
// Revert individual items to original position // Revert individual items to original position
requestItemResize(i.key(), startPos.second, right, false, 0, true); requestItemResize(i.key(), startItemPos.second, right, false, 0, true);
changedItems << i.key(); changedItems << i.key();
} }
} }
for (int id : changedItems) { for (int id : changedItems) {
QPair<int,int> endPos = endData.value(id); QPair<int,int> endItemPos = endData.value(id);
result = result & requestItemResize(id, endPos.second, right, true, undo, redo, false); result = result & requestItemResize(id, endItemPos.second, right, true, undo, redo, false);
if (!result) { if (!result) {
break; break;
} }
......
...@@ -279,7 +279,7 @@ Column{ ...@@ -279,7 +279,7 @@ Column{
} }
onTrimmedIn: { onTrimmedIn: {
bubbleHelp.hide() bubbleHelp.hide()
if (shiftTrim) { if (shiftTrim || clip.groupTrimData == undefined) {
// We only resize one element // We only resize one element
controller.requestItemResize(clip.clipId, clip.originalDuration, false, false, root.snapping, shiftTrim) controller.requestItemResize(clip.clipId, clip.originalDuration, false, false, root.snapping, shiftTrim)
controller.requestItemResize(clip.clipId, clip.lastValidDuration, false, true, root.snapping, shiftTrim) controller.requestItemResize(clip.clipId, clip.lastValidDuration, false, true, root.snapping, shiftTrim)
...@@ -287,7 +287,6 @@ Column{ ...@@ -287,7 +287,6 @@ Column{
var updatedGroupData = controller.getGroupData(clip.clipId) var updatedGroupData = controller.getGroupData(clip.clipId)
controller.processGroupResize(clip.groupTrimData, updatedGroupData, false) controller.processGroupResize(clip.groupTrimData, updatedGroupData, false)
} }
clip.groupTrimData = undefined clip.groupTrimData = undefined
} }
onTrimmingOut: { onTrimmingOut: {
...@@ -305,13 +304,14 @@ Column{ ...@@ -305,13 +304,14 @@ Column{
} }
onTrimmedOut: { onTrimmedOut: {
bubbleHelp.hide() bubbleHelp.hide()
if (shiftTrim) { if (shiftTrim || clip.groupTrimData == undefined) {
controller.requestItemResize(clip.clipId, clip.originalDuration, true, false, root.snapping, shiftTrim) controller.requestItemResize(clip.clipId, clip.originalDuration, true, false, root.snapping, shiftTrim)
controller.requestItemResize(clip.clipId, clip.lastValidDuration, true, true, root.snapping, shiftTrim) controller.requestItemResize(clip.clipId, clip.lastValidDuration, true, true, root.snapping, shiftTrim)
} else { } else {
var updatedGroupData = controller.getGroupData(clip.clipId) var updatedGroupData = controller.getGroupData(clip.clipId)
controller.processGroupResize(clip.groupTrimData, updatedGroupData, true) controller.processGroupResize(clip.groupTrimData, updatedGroupData, true)
} }
clip.groupTrimData = undefined
} }
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment