@@ -641,6 +641,7 @@ MoveClipCommand::MoveClipCommand(
641641 , m_undoHelper(m_model)
642642 , m_redo(false )
643643 , m_earliestStart(-1 )
644+ , m_markersModified(-1 )
644645{
645646 m_undoHelper.setHints (UndoHelper::RestoreTracks);
646647 m_undoHelper.recordBeforeState ();
@@ -810,7 +811,7 @@ void MoveClipCommand::undo()
810811{
811812 LOG_DEBUG () << " track delta" << m_trackDelta;
812813 m_undoHelper.undoChanges ();
813- if (m_rippleMarkers && m_markers. size () >= 0 ) {
814+ if (m_rippleMarkers && m_markersModified == 1 ) {
814815 m_markersModel.doReplace (m_markers);
815816 }
816817 // Select the original clips after undo.
@@ -852,28 +853,28 @@ bool MoveClipCommand::mergeWith(const QUndoCommand *other)
852853
853854void MoveClipCommand::redoMarkers ()
854855{
855- if (m_rippleMarkers) {
856+ if (m_rippleMarkers && m_markersModified == -1 ) {
857+ m_markersModified = 0 ;
856858 if (m_markers.size () == 0 ) {
857859 m_markers = m_markersModel.getMarkers ();
858860 }
859861 QList<Markers::Marker> newMarkers = m_markers;
860- bool markersModified = false ;
861862 for (int i = 0 ; i < newMarkers.size (); i++) {
862863 Markers::Marker &marker = newMarkers[i];
863864 if (marker.start < m_earliestStart
864865 && marker.start > (m_earliestStart + m_positionDelta)) {
865866 // This marker is in the overwritten segment. Remove it
866867 newMarkers.removeAt (i);
867868 i--;
868- markersModified = true ;
869+ m_markersModified = 1 ;
869870 } else if (marker.start >= m_earliestStart) {
870871 // This marker is after the start of the moved segment. Shift it with the move
871872 marker.start += m_positionDelta;
872873 marker.end += m_positionDelta;
873- markersModified = true ;
874+ m_markersModified = 1 ;
874875 }
875876 }
876- if (markersModified ) {
877+ if (m_markersModified == 1 ) {
877878 m_markersModel.doReplace (newMarkers);
878879 } else {
879880 m_markers.clear ();
0 commit comments