From 7ba9d23d7e9621f8905c3510d0488f15660ab203 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Mardelle Date: Wed, 3 Feb 2010 20:07:12 +0000 Subject: [PATCH] Fix possible crash introduced by previous commit svn path=/trunk/kdenlive/; revision=4285 --- src/customtrackview.cpp | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/src/customtrackview.cpp b/src/customtrackview.cpp index da1aa480..05ee6180 100644 --- a/src/customtrackview.cpp +++ b/src/customtrackview.cpp @@ -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 (clip); + //build go to marker menu + if (item->baseClip()) { + QList 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 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) -- 2.39.2