From 6cb2872bd7daee353e2d1071db7dae22d1d2efe7 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Mardelle Date: Mon, 23 Jul 2012 09:07:43 +0200 Subject: [PATCH] newFile: Use QPointer [krazy 21/37] by Mikko Rapeli --- src/mainwindow.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index c28579ee..b64eba7a 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1870,12 +1870,16 @@ void MainWindow::newFile(bool showProjectSettings, bool force) if (!closeCurrentDocument()) return; } else { - ProjectSettings *w = new ProjectSettings(NULL, QMap (), QStringList(), projectTracks.x(), projectTracks.y(), KdenliveSettings::defaultprojectfolder(), false, true, this); - if (w->exec() != QDialog::Accepted) + QPointer w = new ProjectSettings(NULL, QMap (), QStringList(), projectTracks.x(), projectTracks.y(), KdenliveSettings::defaultprojectfolder(), false, true, this); + if (w->exec() != QDialog::Accepted) { + delete w; return; + } if (!KdenliveSettings::activatetabs()) - if (!closeCurrentDocument()) + if (!closeCurrentDocument()) { + delete w; return; + } if (KdenliveSettings::videothumbnails() != w->enableVideoThumbs()) slotSwitchVideoThumbs(); if (KdenliveSettings::audiothumbnails() != w->enableAudioThumbs()) -- 2.39.5