AutoTest: Postpone removal of root node

If a root node should get removed while scanning we may end up
crashing when still getting results.
As there is currently no mechanism to stop a certain parser
postpone the removal of the root node until the parsing is done.

Change-Id: I3766f9e67780e241801166339fa67f39536314b4
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
Christian Stenger
2023-07-10 12:59:00 +02:00
parent 31386c3fa0
commit 4f50b6b791
4 changed files with 18 additions and 4 deletions

View File

@@ -4,7 +4,9 @@
#include "testprojectsettings.h"
#include "autotestconstants.h"
#include "testcodeparser.h"
#include "testframeworkmanager.h"
#include "testtreemodel.h"
#include <projectexplorer/project.h>
#include <projectexplorer/projectmanager.h>
@@ -49,7 +51,9 @@ void TestProjectSettings::activateFramework(const Id &id, bool activate)
{
ITestFramework *framework = TestFrameworkManager::frameworkForId(id);
m_activeTestFrameworks[framework] = activate;
if (!activate)
if (TestTreeModel::instance()->parser()->isParsing())
framework->rootNode()->markForRemoval(!activate);
else if (!activate)
framework->resetRootNode();
}