Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 6a77b16a authored by Nicolas Carion's avatar Nicolas Carion

fix crash when deleting while dragging

parent cdd6c94f
Pipeline #1801 failed with stage
in 14 minutes and 17 seconds
......@@ -215,16 +215,16 @@ public:
int getClipSplitPartner(int clipId) const;
/* @brief Helper function that returns true if the given ID corresponds to a clip */
bool isClip(int id) const;
Q_INVOKABLE bool isClip(int id) const;
/* @brief Helper function that returns true if the given ID corresponds to a composition */
bool isComposition(int id) const;
Q_INVOKABLE bool isComposition(int id) const;
/* @brief Helper function that returns true if the given ID corresponds to a track */
bool isTrack(int id) const;
Q_INVOKABLE bool isTrack(int id) const;
/* @brief Helper function that returns true if the given ID corresponds to a group */
bool isGroup(int id) const;
Q_INVOKABLE bool isGroup(int id) const;
/* @brief Given a composition Id, returns its underlying parameter model */
std::shared_ptr<AssetParameterModel> getCompositionParameterModel(int compoId) const;
......
......@@ -1060,7 +1060,8 @@ Rectangle {
}
}
onPositionChanged: {
if (!shiftClick && dragProxy.draggedItem > -1 && mouse.buttons === Qt.LeftButton) {
// we have to check item validity in the controller, because they could have been deleted since the beginning of the drag
if (!shiftClick && dragProxy.draggedItem > -1 && mouse.buttons === Qt.LeftButton && (controller.isClip(dragProxy.draggedItem) || controller.isComposition(dragProxy.draggedItem))) {
continuousScrolling(mouse.x + parent.x)
var mapped = tracksContainerArea.mapFromItem(dragProxy, mouse.x, mouse.y).x
root.mousePosChanged(Math.round(mapped / timeline.scaleFactor))
......@@ -1100,7 +1101,7 @@ Rectangle {
}
onReleased: {
clipBeingMovedId = -1
if (!shiftClick && dragProxy.draggedItem > -1 && dragFrame > -1) {
if (!shiftClick && dragProxy.draggedItem > -1 && dragFrame > -1 && (controller.isClip(dragProxy.draggedItem) || controller.isComposition(dragProxy.draggedItem))) {
var tId = controller.getItemTrackId(dragProxy.draggedItem)
if (dragProxy.isComposition) {
controller.requestCompositionMove(dragProxy.draggedItem, dragProxy.sourceTrack, dragProxy.sourceFrame, true, false, false)
......
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