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

Fix crash on group cut. Fixes #256

parent d2bb75f4
Pipeline #4358 passed with stage
in 20 minutes and 2 seconds
...@@ -169,11 +169,12 @@ bool TimelineFunctions::requestClipCut(const std::shared_ptr<TimelineItemModel> ...@@ -169,11 +169,12 @@ bool TimelineFunctions::requestClipCut(const std::shared_ptr<TimelineItemModel>
clips.insert(cid); clips.insert(cid);
} }
} }
// We need to call clearSelection before attempting the split or the group split will be corrupted by the selection group (no undo support)
timeline->requestClearSelection();
std::unordered_set<int> topElements; std::unordered_set<int> topElements;
std::transform(clips.begin(), clips.end(), std::inserter(topElements, topElements.begin()), [&](int id) { return timeline->m_groups->getRootId(id); }); std::transform(clips.begin(), clips.end(), std::inserter(topElements, topElements.begin()), [&](int id) { return timeline->m_groups->getRootId(id); });
// We need to call clearSelection before attempting the split or the group split will be corrupted by the selection group (no undo support)
timeline->requestClearSelection();
int count = 0; int count = 0;
QList<int> newIds; QList<int> newIds;
int mainId = -1; int mainId = -1;
...@@ -210,6 +211,7 @@ bool TimelineFunctions::requestClipCut(const std::shared_ptr<TimelineItemModel> ...@@ -210,6 +211,7 @@ bool TimelineFunctions::requestClipCut(const std::shared_ptr<TimelineItemModel>
auto criterion = [timeline, position](int cid) { return timeline->getClipPosition(cid) < position; }; auto criterion = [timeline, position](int cid) { return timeline->getClipPosition(cid) < position; };
bool res = true; bool res = true;
for (const int topId : topElements) { for (const int topId : topElements) {
qDebug()<<"// CHECKING REGROUP ELMENT: "<<topId<<", ISCLIP: "<<timeline->isClip(topId)<<timeline->isGroup(topId);
res = res && timeline->m_groups->split(topId, criterion, undo, redo); res = res && timeline->m_groups->split(topId, criterion, undo, redo);
} }
if (!res) { if (!res) {
......
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