[Kdenlive-devel] [PATCH 19/37] readOptions: Use QPointer

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


Fixes crashes if parent is destroyed. Found by krazy. Details at:
http://blogs.kde.org/node/3919

Delete dialog also on exit path.
---
 src/mainwindow.cpp |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index b9c2190..b296baa 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -1830,12 +1830,13 @@ void MainWindow::readOptions()
 
     if (!initialGroup.exists() || upgrade) {
         // this is our first run, show Wizard
-        Wizard *w = new Wizard(upgrade, this);
+        QPointer<Wizard> w = new Wizard(upgrade, this);
         if (w->exec() == QDialog::Accepted && w->isOk()) {
             w->adjustSettings();
             initialGroup.writeEntry("version", version);
             delete w;
         } else {
+            delete w;
             ::exit(1);
         }
     }
-- 
1.7.10.4





More information about the Kdenlive mailing list