Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Multimedia
Kdenlive
Commits
b128c3b3
Commit
b128c3b3
authored
May 19, 2022
by
Jean-Baptiste Mardelle
Browse files
Fix crash/corruption in overwrite mode when moving grouped clips above or below existing tracks
parent
d90f2723
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/timeline2/model/timelinemodel.cpp
View file @
b128c3b3
...
...
@@ -2207,6 +2207,46 @@ bool TimelineModel::requestFakeGroupMove(int clipId, int groupId, int delta_trac
}
}
bool
trackChanged
=
false
;
if
(
delta_track
!=
0
)
{
//Ensure the track move is possible (not outside our current tracks)
for
(
int
item
:
all_items
)
{
int
current_track_id
=
old_track_ids
[
item
];
int
current_track_position
=
getTrackPosition
(
current_track_id
);
bool
audioTrack
=
getTrackById_const
(
current_track_id
)
->
isAudioTrack
();
int
d
=
audioTrack
?
audio_delta
:
video_delta
;
int
target_track_position
=
current_track_position
+
d
;
bool
brokenMove
=
target_track_position
<
0
||
target_track_position
>=
getTracksCount
();
if
(
!
brokenMove
)
{
int
target_id
=
getTrackIndexFromPosition
(
target_track_position
);
brokenMove
=
audioTrack
!=
getTrackById_const
(
target_id
)
->
isAudioTrack
();
}
if
(
brokenMove
)
{
if
(
isClip
(
item
))
{
int
lastTid
=
m_allClips
[
item
]
->
getFakeTrackId
();
int
originalTid
=
m_allClips
[
item
]
->
getCurrentTrackId
();
int
last_position
=
getTrackPosition
(
lastTid
);
int
original_position
=
getTrackPosition
(
originalTid
);
int
lastDelta
=
last_position
-
original_position
;
if
(
audioTrack
)
{
if
(
qAbs
(
audio_delta
)
>
qAbs
(
lastDelta
))
{
audio_delta
=
lastDelta
;
}
if
(
video_delta
!=
0
)
{
video_delta
=
-
lastDelta
;
}
}
else
{
if
(
qAbs
(
video_delta
)
>
qAbs
(
lastDelta
))
{
video_delta
=
lastDelta
;
}
if
(
audio_delta
!=
0
)
{
audio_delta
=
-
lastDelta
;
}
}
};
}
}
}
// Reverse sort. We need to insert from left to right to avoid confusing the view
for
(
int
item
:
all_items
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment