[Kdenlive-devel] [PATCH 26/37] slotEditClipMarker: Use QPointer

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


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

diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index d91153e..77e58d2 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -2919,14 +2919,16 @@ void MainWindow::slotEditClipMarker()
     }
 
     CommentedTime marker(pos, oldcomment);
-    MarkerDialog d(clip, marker, m_activeDocument->timecode(), i18n("Edit Marker"), this);
-    if (d.exec() == QDialog::Accepted) {
-        m_activeTimeline->projectView()->slotAddClipMarker(id, d.newMarker().time(), d.newMarker().comment());
-        if (d.newMarker().time() != pos) {
+    QPointer<MarkerDialog> d = new MarkerDialog(clip, marker,
+                      m_activeDocument->timecode(), i18n("Edit Marker"), this);
+    if (d->exec() == QDialog::Accepted) {
+        m_activeTimeline->projectView()->slotAddClipMarker(id, d->newMarker().time(), d->newMarker().comment());
+        if (d->newMarker().time() != pos) {
             // remove old marker
             m_activeTimeline->projectView()->slotAddClipMarker(id, pos, QString());
         }
     }
+    delete d;
 }
 
 void MainWindow::slotAddMarkerGuideQuickly()
-- 
1.7.10.4





More information about the Kdenlive mailing list