From c60ab1ca3c8b70588341b4d92f3d972184c14008 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Wed, 8 May 2013 23:16:23 +0300 Subject: Git: Fix object leaks Change-Id: I0efb368782ffb66cf6b8d39650fe7840c5ef2501 Reviewed-by: Tobias Hunger --- src/plugins/git/branchdialog.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/plugins/git/branchdialog.cpp') diff --git a/src/plugins/git/branchdialog.cpp b/src/plugins/git/branchdialog.cpp index 721322fa3a..40574ef1c5 100644 --- a/src/plugins/git/branchdialog.cpp +++ b/src/plugins/git/branchdialog.cpp @@ -139,7 +139,7 @@ void BranchDialog::add() ++i; } - BranchAddDialog branchAddDialog; + BranchAddDialog branchAddDialog(true, this); branchAddDialog.setBranchName(suggestedName); branchAddDialog.setTrackedBranchName(trackedBranch, !isLocal); @@ -249,22 +249,22 @@ void BranchDialog::rename() QString oldBranchName = m_model->branchName(selected); QStringList localNames = m_model->localBranchNames(); - QPointer branchAddDialog = new BranchAddDialog(this, false); - branchAddDialog->setBranchName(oldBranchName); - branchAddDialog->setTrackedBranchName(QString(), false); + BranchAddDialog branchAddDialog(false, this); + branchAddDialog.setBranchName(oldBranchName); + branchAddDialog.setTrackedBranchName(QString(), false); - branchAddDialog->exec(); + branchAddDialog.exec(); - if (!branchAddDialog.isNull() && branchAddDialog->result() == QDialog::Accepted && m_model) { - if (branchAddDialog->branchName() == oldBranchName) + if (branchAddDialog.result() == QDialog::Accepted && m_model) { + if (branchAddDialog.branchName() == oldBranchName) return; - if (localNames.contains(branchAddDialog->branchName())) { + if (localNames.contains(branchAddDialog.branchName())) { QMessageBox::critical(this, tr("Branch Exists"), tr("Local branch \'%1\' already exists.") - .arg(branchAddDialog->branchName())); + .arg(branchAddDialog.branchName())); return; } - m_model->renameBranch(oldBranchName, branchAddDialog->branchName()); + m_model->renameBranch(oldBranchName, branchAddDialog.branchName()); refresh(); } enableButtons(); -- cgit v1.2.1