ValgrindProcess: Emit done() signal just once

Change-Id: Ifb2ea389257e5e8b394d038c226a3104c7c4bb03
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2024-10-02 10:37:36 +02:00
parent 15d5f130f7
commit 565b507554

View File

@@ -95,12 +95,6 @@ public:
connect(process, &Process::started, this, [this, process] { connect(process, &Process::started, this, [this, process] {
emit q->valgrindStarted(process->processId()); emit q->valgrindStarted(process->processId());
}); });
connect(process, &Process::done, this, [this, process] {
const bool success = process->result() == ProcessResult::FinishedWithSuccess;
if (!success)
emit q->processErrorReceived(process->errorString(), process->error());
emit q->done(toDoneResult(success));
});
connect(process, &Process::readyReadStandardOutput, this, [this, process] { connect(process, &Process::readyReadStandardOutput, this, [this, process] {
emit q->appendMessage(process->readAllStandardOutput(), StdOutFormat); emit q->appendMessage(process->readAllStandardOutput(), StdOutFormat);
}); });
@@ -185,6 +179,9 @@ Group ValgrindProcessPrivate::runRecipe() const
const auto onProcessSetup = [this, storage](Process &process) { const auto onProcessSetup = [this, storage](Process &process) {
setupValgrindProcess(&process, storage->m_valgrindCommand); setupValgrindProcess(&process, storage->m_valgrindCommand);
}; };
const auto onProcessDone = [this, storage](const Process &process) {
emit q->processErrorReceived(process.errorString(), process.error());
};
const auto isAddressValid = [this] { return !m_localServerAddress.isNull(); }; const auto isAddressValid = [this] { return !m_localServerAddress.isNull(); };
@@ -194,7 +191,7 @@ Group ValgrindProcessPrivate::runRecipe() const
parser.setSocket(storage->m_xmlSocket.release()); parser.setSocket(storage->m_xmlSocket.release());
}; };
const auto onParserError = [this](const Parser &parser) { const auto onParserDone = [this](const Parser &parser) {
emit q->internalError(parser.errorString()); emit q->internalError(parser.errorString());
}; };
@@ -203,10 +200,10 @@ Group ValgrindProcessPrivate::runRecipe() const
storage, storage,
xmlBarrier, xmlBarrier,
If (isSetupValid) >> Then { If (isSetupValid) >> Then {
ProcessTask(onProcessSetup), ProcessTask(onProcessSetup, onProcessDone, CallDoneIf::Error),
If (isAddressValid) >> Then { If (isAddressValid) >> Then {
waitForBarrierTask(xmlBarrier), waitForBarrierTask(xmlBarrier),
ParserTask(onParserSetup, onParserError, CallDoneIf::Error) ParserTask(onParserSetup, onParserDone, CallDoneIf::Error)
} }
} >> Else { } >> Else {
errorItem errorItem