forked from qt-creator/qt-creator
Git: Fix crash when fetch is done while context menu is active
Blind shot. Task-number: QTCREATORBUG-29266 Change-Id: Ie9e8be9e6ead7a3c49cdde7c3b80b4735f7b19af Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
b3df9a4fcf
commit
5bd2cd0115
@@ -132,12 +132,15 @@ BranchView::BranchView()
|
||||
|
||||
m_branchView->selectionModel()->clear();
|
||||
m_repository = GitPlugin::currentState().topLevel();
|
||||
refreshCurrentRepository();
|
||||
}
|
||||
|
||||
void BranchView::refreshIfSame(const FilePath &repository)
|
||||
{
|
||||
if (m_repository == repository)
|
||||
if (m_repository != repository)
|
||||
return;
|
||||
if (m_blockRefresh)
|
||||
m_postponedRefresh = true;
|
||||
else
|
||||
refreshCurrentRepository();
|
||||
}
|
||||
|
||||
@@ -228,6 +231,7 @@ void BranchView::slotCustomContextMenu(const QPoint &point)
|
||||
std::unique_ptr<TaskTree> taskTree;
|
||||
QAction *mergeAction = nullptr;
|
||||
|
||||
SetInContext block(m_blockRefresh);
|
||||
QMenu contextMenu;
|
||||
contextMenu.addAction(Tr::tr("&Add..."), this, &BranchView::add);
|
||||
const std::optional<QString> remote = m_model->remoteName(index);
|
||||
@@ -256,10 +260,8 @@ void BranchView::slotCustomContextMenu(const QPoint &point)
|
||||
contextMenu.addSeparator();
|
||||
contextMenu.addAction(Tr::tr("&Diff"), this, [this] {
|
||||
const QString fullName = m_model->fullName(selectedIndex(), true);
|
||||
if (!fullName.isEmpty()) {
|
||||
SetInContext block(m_blockRefresh);
|
||||
if (!fullName.isEmpty())
|
||||
GitClient::instance()->diffBranch(m_repository, fullName);
|
||||
}
|
||||
});
|
||||
contextMenu.addAction(Tr::tr("&Log"), this, [this] { log(selectedIndex()); });
|
||||
contextMenu.addAction(Tr::tr("Reflo&g"), this, [this] { reflog(selectedIndex()); });
|
||||
@@ -303,6 +305,10 @@ void BranchView::slotCustomContextMenu(const QPoint &point)
|
||||
}
|
||||
}
|
||||
contextMenu.exec(m_branchView->viewport()->mapToGlobal(point));
|
||||
if (m_postponedRefresh) {
|
||||
refreshCurrentRepository();
|
||||
m_postponedRefresh = false;
|
||||
}
|
||||
}
|
||||
|
||||
void BranchView::expandAndResize()
|
||||
|
||||
Reference in New Issue
Block a user