diff --git a/language/codegen/basicrefactoring.cpp b/language/codegen/basicrefactoring.cpp --- a/language/codegen/basicrefactoring.cpp +++ b/language/codegen/basicrefactoring.cpp @@ -309,8 +309,7 @@ const auto text = renameDialog.edit->text().trimmed(); RefactoringProgressDialog refactoringProgress(i18n("Renaming \"%1\" to \"%2\"", declarationName, text), collector.data()); if (!collector->isReady()) { - refactoringProgress.exec(); - if (refactoringProgress.result() != QDialog::Accepted) { + if (refactoringProgress.exec() != QDialog::Accepted) { // krazy:exclude=crashy return {}; } } diff --git a/plugins/appwizard/appwizardplugin.cpp b/plugins/appwizard/appwizardplugin.cpp --- a/plugins/appwizard/appwizardplugin.cpp +++ b/plugins/appwizard/appwizardplugin.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -84,16 +85,16 @@ { model()->refresh(); - AppWizardDialog dlg(core()->pluginController(), m_templatesModel); + QPointer dlg = new AppWizardDialog(core()->pluginController(), m_templatesModel); - if (dlg.exec() == QDialog::Accepted) + if (dlg->exec() == QDialog::Accepted) { - QString project = createProject( dlg.appInfo() ); + QString project = createProject( dlg->appInfo() ); if (!project.isEmpty()) { core()->projectController()->openProject(QUrl::fromLocalFile(project)); - KConfig templateConfig(dlg.appInfo().appTemplate); + KConfig templateConfig(dlg->appInfo().appTemplate); KConfigGroup general(&templateConfig, "General"); const QStringList fileArgs = general.readEntry("ShowFilesAfterGeneration").split(QLatin1Char(','), QString::SkipEmptyParts); for (const auto& fileArg : fileArgs) { @@ -107,6 +108,8 @@ KMessageBox::error( ICore::self()->uiController()->activeMainWindow(), i18n("Could not create project from template\n"), i18n("Failed to create project") ); } } + + delete dlg; } namespace diff --git a/plugins/appwizard/projectselectionpage.cpp b/plugins/appwizard/projectselectionpage.cpp --- a/plugins/appwizard/projectselectionpage.cpp +++ b/plugins/appwizard/projectselectionpage.cpp @@ -13,6 +13,7 @@ #include #include +#include #include #include @@ -305,31 +306,36 @@ QStringLiteral("application/x-bzip-compressed-tar"), QStringLiteral("application/zip") }; - QFileDialog fileDialog(this, i18n("Load Template From File")); - fileDialog.setMimeTypeFilters(supportedMimeTypes); - fileDialog.setFileMode(QFileDialog::ExistingFiles); + QPointer fileDialog = new QFileDialog(this, i18n("Load Template From File")); + fileDialog->setMimeTypeFilters(supportedMimeTypes); + fileDialog->setFileMode(QFileDialog::ExistingFiles); - if (!fileDialog.exec()) { + if (!fileDialog->exec()) { + delete fileDialog; return; } - for (const auto& fileName : fileDialog.selectedFiles()) { + for (const auto& fileName : fileDialog->selectedFiles()) { QString destination = m_templatesModel->loadTemplateFile(fileName); QModelIndexList indexes = m_templatesModel->templateIndexes(destination); if (indexes.size() > 2) { m_listView->setCurrentIndex(indexes.at(1)); ui->templateType->setCurrentIndex(indexes.at(2).row()); } } + + delete fileDialog; } void ProjectSelectionPage::moreTemplatesClicked() { - KNS3::DownloadDialog dialog(QStringLiteral("kdevappwizard.knsrc"), this); - dialog.exec(); + QPointer dialog = + new KNS3::DownloadDialog(QStringLiteral("kdevappwizard.knsrc"), this); + dialog->exec(); - auto entries = dialog.changedEntries(); + auto entries = dialog->changedEntries(); + delete dialog; if (entries.isEmpty()) { return; } diff --git a/plugins/externalscript/externalscriptview.cpp b/plugins/externalscript/externalscriptview.cpp --- a/plugins/externalscript/externalscriptview.cpp +++ b/plugins/externalscript/externalscriptview.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -135,13 +136,14 @@ void ExternalScriptView::addScript() { ExternalScriptItem* item = new ExternalScriptItem; - EditExternalScript dlg( item, this ); - int ret = dlg.exec(); - if ( ret == QDialog::Accepted) { + QPointer dlg = new EditExternalScript( item, this ); + if ( dlg->exec() == QDialog::Accepted) { m_plugin->model()->appendRow( item ); } else { delete item; } + + delete dlg; } void ExternalScriptView::removeScript() @@ -170,11 +172,12 @@ return; } - EditExternalScript dlg( item, this ); - int ret = dlg.exec(); - if (ret == QDialog::Accepted) { + QPointer dlg = new EditExternalScript( item, this ); + if (dlg->exec() == QDialog::Accepted) { item->save(); } + + delete dlg; } diff --git a/plugins/filetemplates/templateselectionpage.cpp b/plugins/filetemplates/templateselectionpage.cpp --- a/plugins/filetemplates/templateselectionpage.cpp +++ b/plugins/filetemplates/templateselectionpage.cpp @@ -36,6 +36,7 @@ #include "ui_templateselection.h" #include +#include #include #include @@ -159,16 +160,17 @@ QStringLiteral("application/x-bzip-compressed-tar"), QStringLiteral("application/zip") }; - QFileDialog dlg(page); - dlg.setMimeTypeFilters(filters); - dlg.setFileMode(QFileDialog::ExistingFiles); + QPointer dlg = new QFileDialog(page); + dlg->setMimeTypeFilters(filters); + dlg->setFileMode(QFileDialog::ExistingFiles); - if (!dlg.exec()) + if (!dlg->exec()) { + delete dlg; return; } - foreach(const QString& fileName, dlg.selectedFiles()) + foreach(const QString& fileName, dlg->selectedFiles()) { QString destination = model->loadTemplateFile(fileName); QModelIndexList indexes = model->templateIndexes(destination); @@ -178,6 +180,8 @@ ui->view->setCurrentIndex(indexes[1]); } } + + delete dlg; } void TemplateSelectionPage::saveConfig() diff --git a/plugins/git/gitplugin.cpp b/plugins/git/gitplugin.cpp --- a/plugins/git/gitplugin.cpp +++ b/plugins/git/gitplugin.cpp @@ -516,7 +516,7 @@ if(!toadd.isEmpty()) { VcsJob* job = add(toadd); - job->exec(); + job->exec(); // krazy:exclude=crashy } } diff --git a/plugins/subversion/kdevsvnplugin.cpp b/plugins/subversion/kdevsvnplugin.cpp --- a/plugins/subversion/kdevsvnplugin.cpp +++ b/plugins/subversion/kdevsvnplugin.cpp @@ -404,7 +404,7 @@ dlg.urlRequester()->setMode(KFile::Directory | KFile::LocalOnly); } - if (dlg.exec() == QDialog::Accepted) { + if (dlg.exec() == QDialog::Accepted) { // krazy:exclude=crashy KDevelop::ICore::self()->runController()->registerJob(copy(source, dlg.selectedUrl())); } } else { @@ -440,7 +440,7 @@ dlg.urlRequester()->setMode(KFile::Directory | KFile::LocalOnly); } - if (dlg.exec() == QDialog::Accepted) { + if (dlg.exec() == QDialog::Accepted) { // krazy:exclude=crashy KDevelop::ICore::self()->runController()->registerJob(move(source, dlg.selectedUrl())); } } else { diff --git a/plugins/subversion/svnjobbase.cpp b/plugins/subversion/svnjobbase.cpp --- a/plugins/subversion/svnjobbase.cpp +++ b/plugins/subversion/svnjobbase.cpp @@ -68,11 +68,12 @@ qCDebug(PLUGIN_SVN) << "login"; KPasswordDialog dlg( nullptr, KPasswordDialog::ShowUsernameLine | KPasswordDialog::ShowKeepPassword ); dlg.setPrompt( i18n("Enter Login for: %1", realm ) ); - dlg.exec(); - internalJob()->m_login_username = dlg.username(); - internalJob()->m_login_password = dlg.password(); - internalJob()->m_maySave = dlg.keepPassword(); - internalJob()->m_guiSemaphore.release( 1 ); + if (dlg.exec()) { // krazy:exclude=crashy + internalJob()->m_login_username = dlg.username(); + internalJob()->m_login_password = dlg.password(); + internalJob()->m_maySave = dlg.keepPassword(); + internalJob()->m_guiSemaphore.release( 1 ); + } } void SvnJobBase::showNotification( const QString& path, const QString& msg ) diff --git a/project/projectitemlineedit.cpp b/project/projectitemlineedit.cpp --- a/project/projectitemlineedit.cpp +++ b/project/projectitemlineedit.cpp @@ -202,9 +202,7 @@ view->selectionModel()->select(idx, QItemSelectionModel::ClearAndSelect); } - int res = dialog.exec(); - - if(res==QDialog::Accepted && view->selectionModel()->hasSelection()) { + if(dialog.exec() == QDialog::Accepted && view->selectionModel()->hasSelection()) { QModelIndex idx=proxymodel->mapToSource(view->selectionModel()->selectedIndexes().first()); setText(KDevelop::joinWithEscaping(model->pathFromIndex(idx), sep, escape)); diff --git a/shell/documentcontroller.cpp b/shell/documentcontroller.cpp --- a/shell/documentcontroller.cpp +++ b/shell/documentcontroller.cpp @@ -813,9 +813,12 @@ QList checkSave = modifiedDocuments(list); if (!checkSave.isEmpty()) { - KSaveSelectDialog dialog(checkSave, qApp->activeWindow()); - if (dialog.exec() == QDialog::Rejected) - return false; + QPointer dialog = + new KSaveSelectDialog(checkSave, qApp->activeWindow()); + bool saved = dialog->exec(); + delete dialog; + + return saved; } } diff --git a/shell/environmentconfigurebutton.cpp b/shell/environmentconfigurebutton.cpp --- a/shell/environmentconfigurebutton.cpp +++ b/shell/environmentconfigurebutton.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -43,7 +44,7 @@ void showDialog() { - QDialog dlg(qApp->activeWindow()); + QPointer dlg = new QDialog(qApp->activeWindow()); QString selected; if (selectionWidget) { selected = selectionWidget->effectiveProfileName(); @@ -57,19 +58,21 @@ auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); - QObject::connect(buttonBox, &QDialogButtonBox::accepted, &dlg, &QDialog::accept); - QObject::connect(buttonBox, &QDialogButtonBox::rejected, &dlg, &QDialog::reject); + QObject::connect(buttonBox, &QDialogButtonBox::accepted, dlg, &QDialog::accept); + QObject::connect(buttonBox, &QDialogButtonBox::rejected, dlg, &QDialog::reject); auto layout = new QVBoxLayout; layout->addWidget(&prefs); layout->addWidget(buttonBox); - dlg.setLayout(layout); - dlg.setWindowTitle(prefs.fullName()); - dlg.setWindowIcon(prefs.icon()); - dlg.resize(800, 600); - if (dlg.exec() == QDialog::Accepted) { + dlg->setLayout(layout); + dlg->setWindowTitle(prefs.fullName()); + dlg->setWindowIcon(prefs.icon()); + dlg->resize(800, 600); + if (dlg->exec() == QDialog::Accepted) { prefs.apply(); emit q->environmentConfigured(); } + + delete dlg; } EnvironmentConfigureButton *q; diff --git a/shell/loadedpluginsdialog.cpp b/shell/loadedpluginsdialog.cpp --- a/shell/loadedpluginsdialog.cpp +++ b/shell/loadedpluginsdialog.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -240,8 +241,10 @@ if (p) { KAboutData aboutData = KAboutData::fromPluginMetaData(pluginInfo(p)); if (!aboutData.componentName().isEmpty()) { // Be sure the about data is not completely empty - KAboutApplicationDialog aboutPlugin(aboutData, itemView()); - aboutPlugin.exec(); + QPointer aboutPlugin = + new KAboutApplicationDialog(aboutData, itemView()); + aboutPlugin->exec(); + delete aboutPlugin; return; } } diff --git a/shell/mainwindow_actions.cpp b/shell/mainwindow_actions.cpp --- a/shell/mainwindow_actions.cpp +++ b/shell/mainwindow_actions.cpp @@ -21,6 +21,7 @@ */ #include +#include #include #include @@ -206,14 +207,18 @@ void MainWindowPrivate::showAboutPlatform() { - KAboutApplicationDialog dlg(Core::self()->aboutData(), m_mainWindow ); - dlg.exec(); + QPointer dlg = + new KAboutApplicationDialog(Core::self()->aboutData(), m_mainWindow ); + dlg->exec(); + delete dlg; } void MainWindowPrivate::showLoadedPlugins() { - LoadedPluginsDialog dlg(m_mainWindow); - dlg.exec(); + QPointer dlg = + new LoadedPluginsDialog(m_mainWindow); + dlg->exec(); + delete dlg; } void MainWindowPrivate::contextMenuFileNew() diff --git a/shell/projectcontroller.cpp b/shell/projectcontroller.cpp --- a/shell/projectcontroller.cpp +++ b/shell/projectcontroller.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -419,13 +420,18 @@ const QUrl& repoUrl, IPlugin* vcsOrProviderPlugin) { Q_ASSERT(d); - OpenProjectDialog dlg(fetch, startUrl, repoUrl, vcsOrProviderPlugin, Core::self()->uiController()->activeMainWindow()); - if(dlg.exec() == QDialog::Rejected) + QPointer dlg = + new OpenProjectDialog(fetch, startUrl, repoUrl, vcsOrProviderPlugin, + Core::self()->uiController()->activeMainWindow()); + if(dlg->exec() == QDialog::Rejected) { + delete dlg; return QUrl(); + } - QUrl projectFileUrl = dlg.projectFileUrl(); - qCDebug(SHELL) << "selected project:" << projectFileUrl << dlg.projectName() << dlg.projectManager(); - if ( dlg.projectManager() == QLatin1String("") ) { + QUrl projectFileUrl = dlg->projectFileUrl(); + qCDebug(SHELL) << "selected project:" << projectFileUrl << dlg->projectName() << dlg->projectManager(); + if ( dlg->projectManager() == QLatin1String("") ) { + delete dlg; return projectFileUrl; } @@ -435,20 +441,20 @@ { // check whether config is equal bool shouldAsk = true; - if( projectFileUrl == dlg.selectedUrl() ) + if( projectFileUrl == dlg->selectedUrl() ) { if( projectFileUrl.isLocalFile() ) { - shouldAsk = !equalProjectFile( projectFileUrl.toLocalFile(), &dlg ); + shouldAsk = !equalProjectFile( projectFileUrl.toLocalFile(), dlg ); } else { shouldAsk = false; QTemporaryFile tmpFile; if (tmpFile.open()) { auto downloadJob = KIO::file_copy(projectFileUrl, QUrl::fromLocalFile(tmpFile.fileName())); KJobWidgets::setWindow(downloadJob, qApp->activeWindow()); if (downloadJob->exec()) { - shouldAsk = !equalProjectFile(tmpFile.fileName(), &dlg); + shouldAsk = !equalProjectFile(tmpFile.fileName(), dlg); } } } @@ -475,20 +481,24 @@ writeProjectConfigToFile = false; } else if ( ret == KMessageBox::Cancel ) { + delete dlg; return QUrl(); } // else fall through and write new file } else { writeProjectConfigToFile = false; } } if (writeProjectConfigToFile) { - if (!writeProjectSettingsToConfigFile(projectFileUrl, &dlg)) { + if (!writeProjectSettingsToConfigFile(projectFileUrl, dlg)) { KMessageBox::error(d->m_core->uiControllerInternal()->defaultMainWindow(), i18n("Unable to create configuration file %1", projectFileUrl.url())); + delete dlg; return QUrl(); } } + + delete dlg; return projectFileUrl; } @@ -785,10 +795,10 @@ } if ( ! existingSessions.isEmpty() ) { - QDialog dialog(Core::self()->uiControllerInternal()->activeMainWindow()); - dialog.setWindowTitle(i18n("Project Already Open")); + QPointer dialog = new QDialog(Core::self()->uiControllerInternal()->activeMainWindow()); + dialog->setWindowTitle(i18n("Project Already Open")); - auto mainLayout = new QVBoxLayout(&dialog); + auto mainLayout = new QVBoxLayout(dialog); mainLayout->addWidget(new QLabel(i18n("The project you're trying to open is already open in at least one " "other session.
What do you want to do?"))); QGroupBox sessions; @@ -808,11 +818,12 @@ auto okButton = buttonBox->button(QDialogButtonBox::Ok); okButton->setDefault(true); okButton->setShortcut(Qt::CTRL | Qt::Key_Return); - connect(buttonBox, &QDialogButtonBox::accepted, &dialog, &QDialog::accept); - connect(buttonBox, &QDialogButtonBox::rejected, &dialog, &QDialog::reject); + connect(buttonBox, &QDialogButtonBox::accepted, dialog, &QDialog::accept); + connect(buttonBox, &QDialogButtonBox::rejected, dialog, &QDialog::reject); mainLayout->addWidget(buttonBox); - bool success = dialog.exec(); + bool success = dialog->exec(); + delete dialog; if (!success) return; @@ -1158,9 +1169,10 @@ bool ret = showVcsDiff(patchSource); if(!ret) { - VcsCommitDialog *commitDialog = new VcsCommitDialog(patchSource); + QPointer commitDialog = new VcsCommitDialog(patchSource); commitDialog->setCommitCandidates(patchSource->infos()); commitDialog->exec(); + delete commitDialog; } } } diff --git a/shell/sessioncontroller.cpp b/shell/sessioncontroller.cpp --- a/shell/sessioncontroller.cpp +++ b/shell/sessioncontroller.cpp @@ -614,7 +614,7 @@ ///@todo We need a way to get a proper size-hint from the view, but unfortunately, that only seems possible after the view was shown. dialog.resize(QSize(900, 600)); - if(dialog.exec() != QDialog::Accepted) + if(dialog.exec() != QDialog::Accepted) // krazy:exclude=crashy { return QString(); } diff --git a/shell/settings/environmentwidget.cpp b/shell/settings/environmentwidget.cpp --- a/shell/settings/environmentwidget.cpp +++ b/shell/settings/environmentwidget.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -176,10 +177,10 @@ QString EnvironmentWidget::askNewProfileName(const QString& defaultName) { - QDialog dialog(this); - dialog.setWindowTitle(i18n("Enter Name of New Environment Profile")); + QPointer dialog = new QDialog(this); + dialog->setWindowTitle(i18n("Enter Name of New Environment Profile")); - QVBoxLayout *layout = new QVBoxLayout(&dialog); + QVBoxLayout *layout = new QVBoxLayout(dialog); auto editLayout = new QHBoxLayout; @@ -193,11 +194,11 @@ auto okButton = buttonBox->button(QDialogButtonBox::Ok); okButton->setEnabled(false); okButton->setDefault(true); - dialog.connect(buttonBox, &QDialogButtonBox::accepted, &dialog, &QDialog::accept); - dialog.connect(buttonBox, &QDialogButtonBox::rejected, &dialog, &QDialog::reject); + dialog->connect(buttonBox, &QDialogButtonBox::accepted, dialog, &QDialog::accept); + dialog->connect(buttonBox, &QDialogButtonBox::rejected, dialog, &QDialog::reject); layout->addWidget(buttonBox); - auto validator = new ProfileNameValidator(m_environmentProfileListModel, &dialog); + auto validator = new ProfileNameValidator(m_environmentProfileListModel, dialog); connect(edit, &QLineEdit::textChanged, validator, [validator, okButton](const QString& text) { int pos; QString t(text); @@ -208,9 +209,11 @@ edit->setText(defaultName); edit->selectAll(); - if (dialog.exec() != QDialog::Accepted) { + if (dialog->exec() != QDialog::Accepted) { + delete dialog; return {}; } + delete dialog; return edit->text(); } @@ -239,10 +242,10 @@ void EnvironmentWidget::batchModeEditButtonClicked() { - QDialog dialog(this); - dialog.setWindowTitle( i18n( "Batch Edit Mode" ) ); + QPointer dialog = new QDialog(this); + dialog->setWindowTitle( i18n( "Batch Edit Mode" ) ); - QVBoxLayout *layout = new QVBoxLayout(&dialog); + QVBoxLayout *layout = new QVBoxLayout(dialog); auto edit = new QPlainTextEdit; edit->setPlaceholderText(QStringLiteral("VARIABLE1=VALUE1\nVARIABLE2=VALUE2")); @@ -259,15 +262,17 @@ auto okButton = buttonBox->button(QDialogButtonBox::Ok); okButton->setDefault(true); okButton->setShortcut(Qt::CTRL | Qt::Key_Return); - dialog.connect(buttonBox, &QDialogButtonBox::accepted, &dialog, &QDialog::accept); - dialog.connect(buttonBox, &QDialogButtonBox::rejected, &dialog, &QDialog::reject); + dialog->connect(buttonBox, &QDialogButtonBox::accepted, dialog, &QDialog::accept); + dialog->connect(buttonBox, &QDialogButtonBox::rejected, dialog, &QDialog::reject); layout->addWidget(buttonBox); - dialog.resize(600, 400); + dialog->resize(600, 400); - if ( dialog.exec() != QDialog::Accepted ) { + if ( dialog->exec() != QDialog::Accepted ) { + delete dialog; return; } + delete dialog; m_environmentProfileModel->setVariablesFromString(edit->toPlainText()); } diff --git a/shell/settings/sourceformattersettings.cpp b/shell/settings/sourceformattersettings.cpp --- a/shell/settings/sourceformattersettings.cpp +++ b/shell/settings/sourceformattersettings.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -401,11 +402,13 @@ QMimeType mimetype = l.mimetypes.first(); if( QScopedPointer(fmt->formatter->editStyleWidget( mimetype )) ) { - EditStyleDialog dlg( fmt->formatter, mimetype, *l.selectedStyle, this ); - if( dlg.exec() == QDialog::Accepted ) + QPointer dlg = + new EditStyleDialog(fmt->formatter, mimetype, *l.selectedStyle, this); + if( dlg->exec() == QDialog::Accepted ) { - l.selectedStyle->setContent(dlg.content()); + l.selectedStyle->setContent(dlg->content()); } + delete dlg; updatePreview(); emit changed(); } diff --git a/shell/settings/templatepage.cpp b/shell/settings/templatepage.cpp --- a/shell/settings/templatepage.cpp +++ b/shell/settings/templatepage.cpp @@ -33,6 +33,7 @@ #include #include +#include TemplatePage::TemplatePage (KDevelop::ITemplateProvider* provider, QWidget* parent) : QWidget (parent), m_provider(provider) @@ -70,35 +71,42 @@ void TemplatePage::loadFromFile() { - QFileDialog fileDialog(this); - fileDialog.setMimeTypeFilters(m_provider->supportedMimeTypes()); - fileDialog.setFileMode(QFileDialog::ExistingFiles); - if (!fileDialog.exec()) { + QPointer fileDialog = new QFileDialog(this); + fileDialog->setMimeTypeFilters(m_provider->supportedMimeTypes()); + fileDialog->setFileMode(QFileDialog::ExistingFiles); + if (!fileDialog->exec()) { + delete fileDialog; return; } - for (const auto& file : fileDialog.selectedFiles()) { + for (const auto& file : fileDialog->selectedFiles()) { m_provider->loadTemplate(file); } + delete fileDialog; + m_provider->reload(); } void TemplatePage::getMoreTemplates() { - KNS3::DownloadDialog dialog(m_provider->knsConfigurationFile(), this); - dialog.exec(); + QPointer dialog = + new KNS3::DownloadDialog(m_provider->knsConfigurationFile(), this); + dialog->exec(); - if (!dialog.changedEntries().isEmpty()) + if (!dialog->changedEntries().isEmpty()) { m_provider->reload(); } + + delete dialog; } void TemplatePage::shareTemplates() { - KNS3::UploadDialog dialog(m_provider->knsConfigurationFile(), this); - dialog.exec(); + QPointer dialog = + new KNS3::UploadDialog(m_provider->knsConfigurationFile(), this); + dialog->exec(); } void TemplatePage::currentIndexChanged(const QModelIndex& index) diff --git a/shell/uicontroller.cpp b/shell/uicontroller.cpp --- a/shell/uicontroller.cpp +++ b/shell/uicontroller.cpp @@ -434,7 +434,7 @@ if (!mw || !mw->area()) return; - QDialog *dia = new QDialog(mw); + QPointer dia = new QDialog(mw); dia->setWindowTitle(i18n("Select Tool View to Add")); auto mainLayout = new QVBoxLayout(dia); diff --git a/vcs/dvcs/dvcsplugin.cpp b/vcs/dvcs/dvcsplugin.cpp --- a/vcs/dvcs/dvcsplugin.cpp +++ b/vcs/dvcs/dvcsplugin.cpp @@ -29,6 +29,7 @@ #include #include +#include #include #include @@ -128,9 +129,11 @@ ICore::self()->documentController()->saveAllDocuments(); - BranchManager branchManager(stripPathToDir(ctxUrlList.front().toLocalFile()), - this, core()->uiController()->activeMainWindow()); - branchManager.exec(); + QPointer branchManager = + new BranchManager(stripPathToDir(ctxUrlList.front().toLocalFile()), + this, core()->uiController()->activeMainWindow()); + branchManager->exec(); + delete branchManager; } } diff --git a/vcs/vcspluginhelper.cpp b/vcs/vcspluginhelper.cpp --- a/vcs/vcspluginhelper.cpp +++ b/vcs/vcspluginhelper.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -457,9 +458,10 @@ bool ret = showVcsDiff(patchSource); if(!ret) { - VcsCommitDialog *commitDialog = new VcsCommitDialog(patchSource); + QPointer commitDialog = new VcsCommitDialog(patchSource); commitDialog->setCommitCandidates(patchSource->infos()); commitDialog->exec(); + delete commitDialog; } }