From d7b1e87fac17b609ff07e3a9d278926ffa3b48ee Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Mon, 20 Jun 2022 17:38:32 +0200 Subject: [PATCH] ChangeSelectionDialog: Connect to done() signal instead of finished() Don't call blocking waitForStarted() and handle failed to start case inside done() handler. Change-Id: I6f88703c4ddc2c26af27b449eaa5be9ef087b1a2 Reviewed-by: Orgad Shaneh --- src/plugins/git/changeselectiondialog.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/plugins/git/changeselectiondialog.cpp b/src/plugins/git/changeselectiondialog.cpp index 57bd97c1d98..5dd3e199b91 100644 --- a/src/plugins/git/changeselectiondialog.cpp +++ b/src/plugins/git/changeselectiondialog.cpp @@ -165,6 +165,8 @@ void ChangeSelectionDialog::setDetails() m_ui->detailsText->setPlainText(m_process->cleanedStdOut()); palette.setColor(QPalette::Text, theme->color(Theme::TextColorNormal)); m_ui->changeNumberEdit->setPalette(palette); + } else if (m_process->result() == ProcessResult::StartFailed) { + m_ui->detailsText->setPlainText(tr("Error: Could not start Git.")); } else { m_ui->detailsText->setPlainText(tr("Error: Unknown reference")); palette.setColor(QPalette::Text, theme->color(Theme::TextColorError)); @@ -218,17 +220,12 @@ void ChangeSelectionDialog::recalculateDetails() } m_process.reset(new QtcProcess); + connect(m_process.get(), &QtcProcess::done, this, &ChangeSelectionDialog::setDetails); m_process->setWorkingDirectory(workingDir); m_process->setEnvironment(m_gitEnvironment); m_process->setCommand({m_gitExecutable, {"show", "--decorate", "--stat=80", ref}}); - - connect(m_process.get(), &QtcProcess::finished, this, &ChangeSelectionDialog::setDetails); - m_process->start(); - if (!m_process->waitForStarted()) - m_ui->detailsText->setPlainText(tr("Error: Could not start Git.")); - else - m_ui->detailsText->setPlainText(tr("Fetching commit data...")); + m_ui->detailsText->setPlainText(tr("Fetching commit data...")); } void ChangeSelectionDialog::changeTextChanged(const QString &text)