diff --git a/src/plugins/autotest/testtreemodel.cpp b/src/plugins/autotest/testtreemodel.cpp index 8afa753ec05..738ac5bbf00 100644 --- a/src/plugins/autotest/testtreemodel.cpp +++ b/src/plugins/autotest/testtreemodel.cpp @@ -73,12 +73,11 @@ TestTreeModel::~TestTreeModel() void TestTreeModel::setupParsingConnections() { - if (!m_connectionsInitialized) - m_parser->setDirty(); - - m_parser->setState(TestCodeParser::Idle); - if (m_connectionsInitialized) + static bool connectionsInitialized = false; + if (connectionsInitialized) return; + m_parser->setDirty(); + m_parser->setState(TestCodeParser::Idle); ProjectExplorer::SessionManager *sm = ProjectExplorer::SessionManager::instance(); connect(sm, &ProjectExplorer::SessionManager::startupProjectChanged, @@ -97,7 +96,7 @@ void TestTreeModel::setupParsingConnections() m_parser, &TestCodeParser::onQmlDocumentUpdated, Qt::QueuedConnection); connect(qmlJsMM, &QmlJS::ModelManagerInterface::aboutToRemoveFiles, this, &TestTreeModel::removeFiles, Qt::QueuedConnection); - m_connectionsInitialized = true; + connectionsInitialized = true; } bool TestTreeModel::setData(const QModelIndex &index, const QVariant &value, int role) diff --git a/src/plugins/autotest/testtreemodel.h b/src/plugins/autotest/testtreemodel.h index ff74a0c2f96..2259cd64d31 100644 --- a/src/plugins/autotest/testtreemodel.h +++ b/src/plugins/autotest/testtreemodel.h @@ -91,7 +91,6 @@ private: void setupParsingConnections(); TestCodeParser *m_parser; - bool m_connectionsInitialized = false; }; class TestTreeSortFilterModel : public QSortFilterProxyModel