summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/autotest/testtreemodel.cpp4
-rw-r--r--plugins/autotest/testtreemodel.h1
2 files changed, 4 insertions, 1 deletions
diff --git a/plugins/autotest/testtreemodel.cpp b/plugins/autotest/testtreemodel.cpp
index 732b229534..2ee021ad06 100644
--- a/plugins/autotest/testtreemodel.cpp
+++ b/plugins/autotest/testtreemodel.cpp
@@ -102,6 +102,7 @@ TestTreeModel::~TestTreeModel()
void TestTreeModel::enableParsing()
{
+ m_refCounter.ref();
m_parser->setState(TestCodeParser::Idle);
if (m_connectionsInitialized)
return;
@@ -128,7 +129,8 @@ void TestTreeModel::enableParsing()
void TestTreeModel::disableParsing()
{
- m_parser->setState(TestCodeParser::Disabled);
+ if (!m_refCounter.deref())
+ m_parser->setState(TestCodeParser::Disabled);
}
QModelIndex TestTreeModel::index(int row, int column, const QModelIndex &parent) const
diff --git a/plugins/autotest/testtreemodel.h b/plugins/autotest/testtreemodel.h
index b476bb1a5b..15a00ecb38 100644
--- a/plugins/autotest/testtreemodel.h
+++ b/plugins/autotest/testtreemodel.h
@@ -112,6 +112,7 @@ private:
TestTreeItem *m_quickTestRootItem;
TestCodeParser *m_parser;
bool m_connectionsInitialized;
+ QAtomicInt m_refCounter;
};
class TestTreeSortFilterModel : public QSortFilterProxyModel