[Kdenlive-devel] [PATCH 29/37] getNewStuff: Use QPointer

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


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

diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 66ae06a..3cef476 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -3756,13 +3756,14 @@ int MainWindow::getNewStuff(const QString &configFile)
 {
     KNS3::Entry::List entries;
 #if KDE_IS_VERSION(4,3,80)
-    KNS3::DownloadDialog dialog(configFile);
-    dialog.exec();
-    entries = dialog.changedEntries();
+    QPointer<KNS3::DownloadDialog> dialog = new KNS3::DownloadDialog(configFile);
+    dialog->exec();
+    entries = dialog->changedEntries();
     foreach(const KNS3::Entry & entry, entries) {
         if (entry.status() == KNS3::Entry::Installed)
             kDebug() << "// Installed files: " << entry.installedFiles();
     }
+    delete dialog;
 #else
     KNS::Engine engine(0);
     if (engine.init(configFile))
-- 
1.7.10.4





More information about the Kdenlive mailing list