diff options
author | Orgad Shaneh <orgad.shaneh@audiocodes.com> | 2013-05-08 23:16:23 +0300 |
---|---|---|
committer | Orgad Shaneh <orgads@gmail.com> | 2013-05-17 17:59:10 +0200 |
commit | c60ab1ca3c8b70588341b4d92f3d972184c14008 (patch) | |
tree | 31f2156dfb2b1c4875ef8091e7d9cb0bc605b39c /src/plugins/git/gerrit/gerritplugin.cpp | |
parent | f7ac7fb2410c3450e9680ec537da1587e1ba4753 (diff) | |
download | qt-creator-c60ab1ca3c8b70588341b4d92f3d972184c14008.tar.gz |
Git: Fix object leaks
Change-Id: I0efb368782ffb66cf6b8d39650fe7840c5ef2501
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
Diffstat (limited to 'src/plugins/git/gerrit/gerritplugin.cpp')
-rw-r--r-- | src/plugins/git/gerrit/gerritplugin.cpp | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/src/plugins/git/gerrit/gerritplugin.cpp b/src/plugins/git/gerrit/gerritplugin.cpp index 80c23588ae..e3403ca91e 100644 --- a/src/plugins/git/gerrit/gerritplugin.cpp +++ b/src/plugins/git/gerrit/gerritplugin.cpp @@ -366,34 +366,26 @@ void GerritPlugin::push() const QString topLevel = Git::Internal::GitPlugin::instance()->currentState().topLevel(); // QScopedPointer is required to delete the dialog when leaving the function - QScopedPointer<GerritPushDialog> dialog( - new GerritPushDialog(topLevel, m_reviewers, Core::ICore::mainWindow())); + GerritPushDialog dialog(topLevel, m_reviewers, Core::ICore::mainWindow()); - if (!dialog->localChangesFound()) { + if (!dialog.localChangesFound()) { QMessageBox::warning(Core::ICore::mainWindow(), tr("No Local Changes"), tr("Change from HEAD appears to be in remote branch already. Aborting.")); return; } - if (!dialog->valid()) { + if (!dialog.valid()) { QMessageBox::warning(Core::ICore::mainWindow(), tr("Initialization Failed"), tr("Failed to initialize dialog. Aborting.")); return; } - // QPointer is required to detect dialog deletion while in exec() - QPointer<GerritPushDialog> dlg = dialog.data(); - if (dialog->exec() == QDialog::Rejected) + if (dialog.exec() == QDialog::Rejected) return; - if (dlg.isNull()) { - dialog.take(); - return; - } - QStringList args; - m_reviewers = dialog->reviewers(); + m_reviewers = dialog.reviewers(); const QStringList reviewers = m_reviewers.split(QLatin1Char(','), QString::SkipEmptyParts); if (!reviewers.isEmpty()) { @@ -406,13 +398,13 @@ void GerritPlugin::push() args << reviewersFlag; } - args << dialog->selectedRemoteName(); - QString target = dialog->selectedCommit(); + args << dialog.selectedRemoteName(); + QString target = dialog.selectedCommit(); if (target.isEmpty()) target = QLatin1String("HEAD"); - target += QLatin1String(":refs/") + dialog->selectedPushType() + - QLatin1Char('/') + dialog->selectedRemoteBranchName(); - const QString topic = dialog->selectedTopic(); + target += QLatin1String(":refs/") + dialog.selectedPushType() + + QLatin1Char('/') + dialog.selectedRemoteBranchName(); + const QString topic = dialog.selectedTopic(); if (!topic.isEmpty()) target += QLatin1Char('/') + topic; args << target; |