[Kdenlive-devel] [PATCH 14/37] slotEditTimeLineGuide: Use QPointer

Mikko Rapeli mikko.rapeli at iki.fi
Thu Jun 28 13:52:52 UTC 2012


Fixes crashes if parent is destroyed. Found by krazy. Details at:
http://blogs.kde.org/node/3919
---
 src/customtrackview.cpp |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/customtrackview.cpp b/src/customtrackview.cpp
index 139654c..38f557d 100644
--- a/src/customtrackview.cpp
+++ b/src/customtrackview.cpp
@@ -5308,11 +5308,13 @@ void CustomTrackView::slotEditTimeLineGuide()
 {
     if (m_dragGuide == NULL) return;
     CommentedTime guide = m_dragGuide->info();
-    MarkerDialog d(NULL, guide, m_document->timecode(), i18n("Edit Guide"), this);
-    if (d.exec() == QDialog::Accepted) {
-        EditGuideCommand *command = new EditGuideCommand(this, guide.time(), guide.comment(), d.newMarker().time(), d.newMarker().comment(), true);
+    QPointer<MarkerDialog> d = new MarkerDialog(NULL, guide,
+                     m_document->timecode(), i18n("Edit Guide"), this);
+    if (d->exec() == QDialog::Accepted) {
+        EditGuideCommand *command = new EditGuideCommand(this, guide.time(), guide.comment(), d->newMarker().time(), d->newMarker().comment(), true);
         m_commandStack->push(command);
     }
+    delete d;
 }
 
 void CustomTrackView::slotDeleteGuide(int guidePos)
-- 
1.7.10.4





More information about the Kdenlive mailing list