Fix enabling and disabling test code parser

Change-Id: If03752aaf3db36929e5e9d1b468e691e4dab1b96
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
This commit is contained in:
Christian Stenger
2015-04-15 09:34:11 +02:00
parent 00ca77a560
commit 7a8b73a0ca
2 changed files with 4 additions and 1 deletions

View File

@@ -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

View File

@@ -112,6 +112,7 @@ private:
TestTreeItem *m_quickTestRootItem;
TestCodeParser *m_parser;
bool m_connectionsInitialized;
QAtomicInt m_refCounter;
};
class TestTreeSortFilterModel : public QSortFilterProxyModel