[multimedia/kdenlive] src/timeline2/view: Fix track index confusion causing crash on add transition

Jean-Baptiste Mardelle <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 34fbd7190bb970191f5c53571263a20155acf036 by Jean-Baptiste Mardelle.
Committed on 16/08/2026 at 05:46.
Pushed by mardelle into branch 'master'.

Fix track index confusion causing crash on add transition

M  +5    -5    src/timeline2/view/timelinecontroller.cpp

https://invent.kde.org/multimedia/kdenlive/-/commit/34fbd7190bb970191f5c53571263a20155acf036

diff --git a/src/timeline2/view/timelinecontroller.cpp b/src/timeline2/view/timelinecontroller.cpp
index f63b1ab072..0284d92791 100644
--- a/src/timeline2/view/timelinecontroller.cpp
+++ b/src/timeline2/view/timelinecontroller.cpp
@@ -599,14 +599,14 @@ int TimelineController::insertNewComposition(int tid, int clipId, int offset, QS
     int position = minimumPos;
     int duration = qMin(clip_duration, pCore->getDurationFromString(KdenliveSettings::transition_duration()));
     int previousTrack = m_model->getPreviousTrackId(tid);
-    int lowerVideoTrackId = 0;
+    int lowerVideoTrackMltIndex = 0;
     if (previousTrack != tid) {
-        lowerVideoTrackId = m_model->getTrackMltIndex(previousTrack);
+        lowerVideoTrackMltIndex = m_model->getTrackMltIndex(previousTrack);
     }
     bool revert = offset > clip_duration / 2;
     int bottomId = 0;
-    if (lowerVideoTrackId > 0) {
-        bottomId = m_model->getTrackById_const(lowerVideoTrackId)->getClipByPosition(position + offset);
+    if (lowerVideoTrackMltIndex > 0) {
+        bottomId = m_model->getTrackById_const(previousTrack)->getClipByPosition(position + offset);
     }
     if (bottomId <= 0) {
         // No video track underneath
@@ -635,7 +635,7 @@ int TimelineController::insertNewComposition(int tid, int clipId, int offset, QS
             }
         } else if (position >= bottom.first) {
             // Lower clip is before or at same pos as top clip
-            int test_duration = m_model->getTrackById_const(lowerVideoTrackId)->suggestCompositionLength(position);
+            int test_duration = m_model->getTrackById_const(previousTrack)->suggestCompositionLength(position);
             if (test_duration > 0) {
                 duration = qMin(test_duration, clip_duration);
             }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.