[multimedia/kdenlive/release/26.08] src/timeline2/model: Fix timeline clip deletion when toggling proxy on reversed clips

Jean-Baptiste Mardelle <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit ea73c221dfcc3f8cee7237d314da39d453ebe964 by Jean-Baptiste Mardelle, on behalf of Jaimukund Bhan.
Committed on 07/08/2026 at 11:49.
Pushed by mardelle into branch 'release/26.08'.

Fix timeline clip deletion when toggling proxy on reversed clips

Reversed timeline clips disappear when enabling or disabling Proxy mode on their parent clip in the Project Bin. When toggling proxy status on a bin clip, `TimelineModel::requestClipReload()` refreshes timeline clip instances. Previously, `updatedDuration` was calculated as:

```
int updatedDuration = qCeil(binClip->frameDuration() / speed);
```

For reversed clips (speed \< 0), this produced a negative `updatedDuration`. The subsequent out-of-bounds check (oldIn \>= updatedDuration) evaluated to true, causing Kdenlive to delete the clip from the timeline. Use `qAbs(speed)` when calculating `updatedDuration` in `TimelineModel::requestClipReload()` to ensure the duration magnitude remains positive and valid regardless of playback direction.

BUG: 523788

M  +1    -1    src/timeline2/model/timelinemodel.cpp

https://invent.kde.org/multimedia/kdenlive/-/commit/ea73c221dfcc3f8cee7237d314da39d453ebe964

diff --git a/src/timeline2/model/timelinemodel.cpp b/src/timeline2/model/timelinemodel.cpp
index 547d83ba36..0e3ced23ad 100644
--- a/src/timeline2/model/timelinemodel.cpp
+++ b/src/timeline2/model/timelinemodel.cpp
@@ -7093,7 +7093,7 @@ bool TimelineModel::requestClipReload(int clipId, int forceDuration, Fun &local_
     bool timeremap = m_allClips[clipId]->hasTimeRemap();
     // Check if clip out is longer than actual producer duration (if user forced duration)
     std::shared_ptr<ProjectClip> binClip = pCore->projectItemModel()->getClipByBinID(getClipBinId(clipId));
-    int updatedDuration = qCeil(binClip->frameDuration() / speed);
+    int updatedDuration = qCeil(binClip->frameDuration() / qAbs(speed));
     bool clipIsShorter = oldOut > updatedDuration;
     if (clipIsShorter) {
         // Check if clip should be completely deleted
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.