diff --git a/src/plugins/git/branchview.cpp b/src/plugins/git/branchview.cpp index a5307536da3..ed6ce90456f 100644 --- a/src/plugins/git/branchview.cpp +++ b/src/plugins/git/branchview.cpp @@ -277,14 +277,15 @@ void BranchView::slotCustomContextMenu(const QPoint &point) .arg(indexName, currentName), this, [this] { merge(false); }); - taskTree.reset(onFastForwardMerge([&] { + taskTree.reset(new TaskTree(fastForwardMergeRecipe([&] { auto ffMerge = new QAction( Tr::tr("&Merge \"%1\" into \"%2\" (Fast-Forward)").arg(indexName, currentName)); connect(ffMerge, &QAction::triggered, this, [this] { merge(true); }); contextMenu.insertAction(mergeAction, ffMerge); mergeAction->setText(Tr::tr("Merge \"%1\" into \"%2\" (No &Fast-Forward)") .arg(indexName, currentName)); - })); + }))); + taskTree->start(); connect(mergeAction, &QObject::destroyed, taskTree.get(), &TaskTree::stop); contextMenu.addAction(Tr::tr("&Rebase \"%1\" on \"%2\"") @@ -534,7 +535,7 @@ bool BranchView::reset(const QByteArray &resetType) return false; } -TaskTree *BranchView::onFastForwardMerge(const std::function &callback) +Group BranchView::fastForwardMergeRecipe(const std::function &callback) { const QModelIndex selected = selectedIndex(); QTC_CHECK(selected != m_model->currentBranch()); @@ -572,9 +573,7 @@ TaskTree *BranchView::onFastForwardMerge(const std::function &callback) callback(); }, CallDoneIf::Success) }; - auto taskTree = new TaskTree(root); - taskTree->start(); - return taskTree; + return root; } bool BranchView::merge(bool allowFastForward) diff --git a/src/plugins/git/branchview.h b/src/plugins/git/branchview.h index 5c16af16d5b..51b5c45ff6d 100644 --- a/src/plugins/git/branchview.h +++ b/src/plugins/git/branchview.h @@ -17,7 +17,7 @@ class QToolButton; class QTreeView; QT_END_NAMESPACE; -namespace Tasking { class TaskTree; } +namespace Tasking { class Group; } namespace Utils { class ElidingLabel; @@ -56,7 +56,7 @@ private: bool remove(); bool rename(); bool reset(const QByteArray &resetType); - Tasking::TaskTree *onFastForwardMerge(const std::function &callback); + Tasking::Group fastForwardMergeRecipe(const std::function &callback); bool merge(bool allowFastForward); void rebase(); bool cherryPick();