summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Stenger <christian.stenger@theqtcompany.com>2015-04-15 09:34:11 +0200
committerChristian Stenger <christian.stenger@theqtcompany.com>2015-04-16 16:22:37 +0300
commit7a8b73a0caf0d3ede1b81049ae05b3ffdd51e71d (patch)
tree867377b4da0dca3d6288634b885ed378a41f8f38
parent00ca77a560021c332b3d6f76efb79d082e930da0 (diff)
downloadqt-creator-7a8b73a0caf0d3ede1b81049ae05b3ffdd51e71d.tar.gz
Fix enabling and disabling test code parser
Change-Id: If03752aaf3db36929e5e9d1b468e691e4dab1b96 Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
-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