AutoTest: Avoid crash in illegal state

While debugging tests we rely on some states of the debugger.
If anything goes wrong we might end in an illegal state on
our side as well. This would then result in a crash.
Avoid nullptr access and try to recover from illegal state.

Change-Id: If8ca396a6e456d2f37777eba86f320643fbcd275
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Stenger
2018-08-02 15:49:02 +02:00
parent e3a0a710c6
commit 18617668a0

View File

@@ -239,7 +239,8 @@ void TestRunner::cancelCurrent(TestRunner::CancelReason reason)
void TestRunner::onProcessFinished()
{
if (m_currentConfig) {
if (m_executingTests && QTC_GUARD(m_currentConfig)) {
QTC_CHECK(m_fakeFutureInterface);
m_fakeFutureInterface->setProgressValue(m_fakeFutureInterface->progressValue()
+ m_currentConfig->testCaseCount());
if (!m_fakeFutureInterface->isCanceled()) {
@@ -258,6 +259,10 @@ void TestRunner::onProcessFinished()
}
resetInternalPointers();
if (!m_fakeFutureInterface) {
QTC_ASSERT(!m_executingTests, m_executingTests = false);
return;
}
if (!m_selectedTests.isEmpty() && !m_fakeFutureInterface->isCanceled())
scheduleNext();
else