forked from qt-creator/qt-creator
AutoTest: Avoid fetching WorkingCopy from multiple threads
Instead fetch it once before starting asynchronous processing and accept that current state of the WorkingCopy might be not completely up to date. This avoids a crash that might happen when the code model tries to update the WorkingCopy while the test code parser fetches information of the WorkingCopy. Change-Id: I2a893bc8814090361305657ed3c3d772c7bf07d5 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
@@ -76,6 +76,7 @@ TestCodeParser::TestCodeParser(TestTreeModel *parent)
|
||||
this, [this] (int index) {
|
||||
emit testParseResultReady(m_futureWatcher.resultAt(index));
|
||||
});
|
||||
connect(this, &TestCodeParser::parsingFinished, this, &TestCodeParser::releaseParserInternals);
|
||||
}
|
||||
|
||||
TestCodeParser::~TestCodeParser()
|
||||
@@ -425,5 +426,11 @@ void TestCodeParser::onPartialParsingFinished()
|
||||
}
|
||||
}
|
||||
|
||||
void TestCodeParser::releaseParserInternals()
|
||||
{
|
||||
for (ITestParser *parser : m_testCodeParsers)
|
||||
parser->release();
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Autotest
|
||||
|
||||
Reference in New Issue
Block a user