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

diff --git a/src/kdenlivesettingsdialog.cpp b/src/kdenlivesettingsdialog.cpp
index 89ba2b1..b91654e 100644
--- a/src/kdenlivesettingsdialog.cpp
+++ b/src/kdenlivesettingsdialog.cpp
@@ -480,34 +480,45 @@ void KdenliveSettingsDialog::showPage(int page, int 
option)
 void KdenliveSettingsDialog::slotEditVideoApplication()
 {
     KService::Ptr service;
-    KOpenWithDialog dlg(KUrl::List(), i18n("Select default video player"), 
m_configEnv.kcfg_defaultplayerapp->text(), this);
-    if (dlg.exec() != QDialog::Accepted)
+    QPointer<KOpenWithDialog> dlg = new KOpenWithDialog(KUrl::List(), 
i18n("Select default video player"), m_configEnv.kcfg_defaultplayerapp->text(), 
this);
+    if (dlg->exec() != QDialog::Accepted)
+    {
+        delete dlg;
         return;
+    }
 
-    service = dlg.service();
+    service = dlg->service();
     m_configEnv.kcfg_defaultplayerapp->setText(service->exec());
+    delete dlg;
 }
 
 void KdenliveSettingsDialog::slotEditAudioApplication()
 {
     KService::Ptr service;
-    KOpenWithDialog dlg(KUrl::List(), i18n("Select default audio editor"), 
m_configEnv.kcfg_defaultaudioapp->text(), this);
-    if (dlg.exec() != QDialog::Accepted)
+    QPointer<KOpenWithDialog> dlg = new KOpenWithDialog(KUrl::List(), 
i18n("Select default audio editor"), m_configEnv.kcfg_defaultaudioapp->text(), 
this);
+    if (dlg->exec() != QDialog::Accepted)
+    {
+        delete dlg;
         return;
+    }
 
-    service = dlg.service();
+    service = dlg->service();
     m_configEnv.kcfg_defaultaudioapp->setText(service->exec());
+    delete dlg;
 }
 
 void KdenliveSettingsDialog::slotEditImageApplication()
 {
     KService::Ptr service;
-    KOpenWithDialog dlg(KUrl::List(), i18n("Select default image editor"), 
m_configEnv.kcfg_defaultimageapp->text(), this);
-    if (dlg.exec() != QDialog::Accepted)
+    QPointer<KOpenWithDialog> dlg = new KOpenWithDialog(KUrl::List(), 
i18n("Select default image editor"), m_configEnv.kcfg_defaultimageapp->text(), 
this);
+    if (dlg->exec() != QDialog::Accepted)
+    {
+        delete dlg;
         return;
-
-    service = dlg.service();
+    }
+    service = dlg->service();
     m_configEnv.kcfg_defaultimageapp->setText(service->exec());
+    delete dlg;
 }
 
 #ifdef USE_JOGSHUTTLE
@@ -988,7 +999,7 @@ void KdenliveSettingsDialog::slotManageEncodingProfile()
         if (m_configCapture.tabWidget->currentIndex() == 1) type = 1;
         else if (m_configCapture.tabWidget->currentIndex() == 3) type = 2;
     }
-    EncodingProfilesDialog *d = new EncodingProfilesDialog(type);
+    QPointer<EncodingProfilesDialog> d = new EncodingProfilesDialog(type);
     d->exec();
     delete d;
     loadEncodingProfiles();
@@ -1076,7 +1087,7 @@ void KdenliveSettingsDialog::slotUpdateProxyProfile(int 
ix)
 void KdenliveSettingsDialog::slotEditVideo4LinuxProfile()
 {
     QString vl4ProfilePath = KStandardDirs::locateLocal("appdata", 
"profiles/video4linux");
-    ProfilesDialog *w = new ProfilesDialog(vl4ProfilePath);
+    QPointer<ProfilesDialog> w = new ProfilesDialog(vl4ProfilePath);
     if (w->exec() == QDialog::Accepted) {
         // save and update profile
         loadCurrentV4lProfileInfo();
-- 
1.7.10.4


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Kdenlive-devel mailing list
Kdenlive-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kdenlive-devel

Reply via email to