[Kdenlive-devel] [PATCH 12/37] slotAddGuide: Use QPointer

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


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

diff --git a/src/customtrackview.cpp b/src/customtrackview.cpp
index e6b71d5..8c3a8a9 100644
--- a/src/customtrackview.cpp
+++ b/src/customtrackview.cpp
@@ -5260,10 +5260,14 @@ void CustomTrackView::slotAddGuide(bool dialog)
 {
     CommentedTime marker(GenTime(m_cursorPos, m_document->fps()), i18n("Guide"));
     if (dialog) {
-        MarkerDialog d(NULL, marker, m_document->timecode(), i18n("Add Guide"), this);
-        if (d.exec() != QDialog::Accepted) return;
-        marker = d.newMarker();
-        
+        QPointer<MarkerDialog> d = new MarkerDialog(NULL, marker,
+                             m_document->timecode(), i18n("Add Guide"), this);
+        if (d->exec() != QDialog::Accepted) {
+            delete d;
+            return;
+        }
+        marker = d->newMarker();
+        delete d;
     } else {
         marker.setComment(m_document->timecode().getDisplayTimecodeFromFrames(m_cursorPos, false));
     }
-- 
1.7.10.4





More information about the Kdenlive mailing list