TestOutputReader: Don't store test process

Test process may be deleted when reader is still alive.

Change-Id: I534d5bcebc6040305c4d937174db9444f6633df8
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Jarek Kobus
2023-01-16 22:10:10 +01:00
parent 51fed728e1
commit b4b2600715
5 changed files with 16 additions and 14 deletions

View File

@@ -29,7 +29,6 @@ FilePath TestOutputReader::constructSourceFilePath(const FilePath &path, const Q
TestOutputReader::TestOutputReader(const QFutureInterface<TestResult> &futureInterface,
QtcProcess *testApplication, const FilePath &buildDirectory)
: m_futureInterface(futureInterface)
, m_testApplication(testApplication)
, m_buildDir(buildDirectory)
, m_id(testApplication ? testApplication->commandLine().executable().toUserOutput() : QString())
{
@@ -41,11 +40,11 @@ TestOutputReader::TestOutputReader(const QFutureInterface<TestResult> &futureInt
return line;
};
if (m_testApplication) {
m_testApplication->setStdOutLineCallback([this, &chopLineBreak](const QString &line) {
if (testApplication) {
testApplication->setStdOutLineCallback([this, &chopLineBreak](const QString &line) {
processStdOutput(chopLineBreak(line.toUtf8()));
});
m_testApplication->setStdErrLineCallback([this, &chopLineBreak](const QString &line) {
testApplication->setStdErrLineCallback([this, &chopLineBreak](const QString &line) {
processStdError(chopLineBreak(line.toUtf8()));
});
}