[Kdenlive-devel] [PATCH 25/37] slotAddClipMarker: Use QPointer

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


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

diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 4edb4b5..d91153e 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -2833,9 +2833,11 @@ void MainWindow::slotAddClipMarker()
     }
     QString id = clip->getId();
     CommentedTime marker(pos, i18n("Marker"));
-    MarkerDialog d(clip, marker, m_activeDocument->timecode(), i18n("Add Marker"), this);
-    if (d.exec() == QDialog::Accepted)
-        m_activeTimeline->projectView()->slotAddClipMarker(id, d.newMarker().time(), d.newMarker().comment());
+    QPointer<MarkerDialog> d = new MarkerDialog(clip, marker,
+                       m_activeDocument->timecode(), i18n("Add Marker"), this);
+    if (d->exec() == QDialog::Accepted)
+        m_activeTimeline->projectView()->slotAddClipMarker(id, d->newMarker().time(), d->newMarker().comment());
+    delete d;
 }
 
 void MainWindow::slotDeleteClipMarker()
-- 
1.7.10.4





More information about the Kdenlive mailing list