diff --git a/src/plugins/valgrind/valgrindengine.cpp b/src/plugins/valgrind/valgrindengine.cpp index 1ab2ae4bc41..ecaa0a723db 100644 --- a/src/plugins/valgrind/valgrindengine.cpp +++ b/src/plugins/valgrind/valgrindengine.cpp @@ -31,8 +31,31 @@ ValgrindToolRunner::ValgrindToolRunner(RunControl *runControl) connect(&m_runner, &ValgrindProcess::appendMessage, this, [this](const QString &msg, Utils::OutputFormat format) { appendMessage(msg, format); }); - connect(&m_runner, &ValgrindProcess::processErrorReceived, - this, &ValgrindToolRunner::receiveProcessError); + connect(&m_runner, &ValgrindProcess::processErrorReceived, this, + [this, runControl](const QString &errorString, Utils::ProcessResult result) { + switch (result) { + case ProcessResult::StartFailed: { + const FilePath valgrind = m_settings.valgrindExecutable(); + if (!valgrind.isEmpty()) { + appendMessage(Tr::tr("Error: \"%1\" could not be started: %2") + .arg(valgrind.toUserOutput(), errorString), ErrorMessageFormat); + } else { + appendMessage(Tr::tr("Error: no Valgrind executable set."), ErrorMessageFormat); + } + break; + } + case ProcessResult::Canceled: + appendMessage(Tr::tr("Process terminated."), ErrorMessageFormat); + return; // Intentional. + case ProcessResult::FinishedWithError: + appendMessage(Tr::tr("Process exited with return value %1\n").arg(errorString), NormalMessageFormat); + break; + default: + break; + } + runControl->showOutputPane(); + + }); connect(&m_runner, &ValgrindProcess::done, this, [this] { appendMessage(Tr::tr("Analyzing finished."), NormalMessageFormat); m_progress.reportFinished(); @@ -115,29 +138,4 @@ QStringList ValgrindToolRunner::genericToolArguments() const return {"--smc-check=" + smcCheckValue}; } -void ValgrindToolRunner::receiveProcessError(const QString &errorString, ProcessResult result) -{ - switch (result) { - case ProcessResult::StartFailed: { - const FilePath valgrind = m_settings.valgrindExecutable(); - if (!valgrind.isEmpty()) { - appendMessage(Tr::tr("Error: \"%1\" could not be started: %2") - .arg(valgrind.toUserOutput(), errorString), ErrorMessageFormat); - } else { - appendMessage(Tr::tr("Error: no Valgrind executable set."), ErrorMessageFormat); - } - break; - } - case ProcessResult::Canceled: - appendMessage(Tr::tr("Process terminated."), ErrorMessageFormat); - return; // Intentional. - case ProcessResult::FinishedWithError: - appendMessage(Tr::tr("Process exited with return value %1\n").arg(errorString), NormalMessageFormat); - break; - default: - break; - } - runControl()->showOutputPane(); -} - } // Valgrid::Internal diff --git a/src/plugins/valgrind/valgrindengine.h b/src/plugins/valgrind/valgrindengine.h index 3a4246bc37d..1b1dd2b9239 100644 --- a/src/plugins/valgrind/valgrindengine.h +++ b/src/plugins/valgrind/valgrindengine.h @@ -28,7 +28,6 @@ protected: ValgrindProcess m_runner; private: - void receiveProcessError(const QString &errorString, Utils::ProcessResult result); QStringList genericToolArguments() const; private: