]> git.sesse.net Git - kdenlive/commitdiff
Fix possible crash introduced by previous commit
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Wed, 3 Feb 2010 20:07:12 +0000 (20:07 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Wed, 3 Feb 2010 20:07:12 +0000 (20:07 +0000)
svn path=/trunk/kdenlive/; revision=4285

src/customtrackview.cpp

index da1aa4801d79e3489c0fbb93f3ef1c59d50b9773..05ee6180379d4fbfa59faef63ea326fc6e0d0e9b 100644 (file)
@@ -1288,9 +1288,10 @@ void CustomTrackView::displayContextMenu(QPoint pos, AbstractClipItem *clip, Abs
 {
     m_deleteGuide->setEnabled(m_dragGuide != NULL);
     m_editGuide->setEnabled(m_dragGuide != NULL);
+    m_markerMenu->clear();
+    m_markerMenu->setEnabled(false);
     if (clip == NULL) {
         m_timelineContextMenu->popup(pos);
-        m_markerMenu->setEnabled(false);
     } else if (group != NULL) {
         m_pasteEffectsAction->setEnabled(m_copiedItems.count() == 1);
         m_ungroupAction->setEnabled(true);
@@ -1300,6 +1301,20 @@ void CustomTrackView::displayContextMenu(QPoint pos, AbstractClipItem *clip, Abs
         m_ungroupAction->setEnabled(false);
         if (clip->type() == AVWIDGET) {
             ClipItem *item = static_cast <ClipItem*>(clip);
+            //build go to marker menu
+            if (item->baseClip()) {
+                QList <CommentedTime> markers = item->baseClip()->commentedSnapMarkers();
+                int offset = item->startPos().frames(m_document->fps());
+                if (!markers.isEmpty()) {
+                    for (int i = 0; i < markers.count(); i++) {
+                        int pos = (int) markers.at(i).time().frames(m_document->timecode().fps());
+                        QString position = m_document->timecode().getTimecode(markers.at(i).time()) + ' ' + markers.at(i).comment();
+                        QAction *go = m_markerMenu->addAction(position);
+                        go->setData(pos + offset);
+                    }
+                }
+                m_markerMenu->setEnabled(!m_markerMenu->isEmpty());
+            }
             updateClipTypeActions(item);
             m_pasteEffectsAction->setEnabled(m_copiedItems.count() == 1);
             m_timelineContextClipMenu->popup(pos);
@@ -5483,23 +5498,6 @@ void CustomTrackView::updateClipTypeActions(ClipItem *clip)
             }
         }
     }
-    if (clip == NULL) {
-        m_markerMenu->clear();
-        m_markerMenu->setEnabled(false);
-    } else {
-        m_markerMenu->clear();
-        QList <CommentedTime> markers = clip->baseClip()->commentedSnapMarkers();
-        int offset = clip->startPos().frames(m_document->fps());
-        if (!markers.isEmpty()) {
-            for (int i = 0; i < markers.count(); i++) {
-                int pos = (int) markers.at(i).time().frames(m_document->timecode().fps());
-                QString position = m_document->timecode().getTimecode(markers.at(i).time()) + ' ' + markers.at(i).comment();
-                QAction *go = m_markerMenu->addAction(position);
-                go->setData(pos + offset);
-            }
-        }
-        m_markerMenu->setEnabled(!m_markerMenu->isEmpty());
-    }
 }
 
 void CustomTrackView::slotGoToMarker(QAction *action)