From 7a8b73a0caf0d3ede1b81049ae05b3ffdd51e71d Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Wed, 15 Apr 2015 09:34:11 +0200 Subject: [PATCH] Fix enabling and disabling test code parser Change-Id: If03752aaf3db36929e5e9d1b468e691e4dab1b96 Reviewed-by: David Schulz --- plugins/autotest/testtreemodel.cpp | 4 +++- plugins/autotest/testtreemodel.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/autotest/testtreemodel.cpp b/plugins/autotest/testtreemodel.cpp index 732b229534c..2ee021ad06b 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 b476bb1a5bf..15a00ecb387 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