From 377408b1b05df5dbc9ed9584408ac9750a81fb33 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Mon, 30 Mar 2015 10:44:54 +0200 Subject: [PATCH] Fix parser state handling... ...especially state transitions that may happen while project files are evaluated or source files are parsed. Change-Id: Iceef38500b6d6a4deb430738e5e960077f8eb39a Reviewed-by: David Schulz --- plugins/autotest/testcodeparser.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plugins/autotest/testcodeparser.cpp b/plugins/autotest/testcodeparser.cpp index 2ffe2a137e3..df147835a53 100644 --- a/plugins/autotest/testcodeparser.cpp +++ b/plugins/autotest/testcodeparser.cpp @@ -87,6 +87,9 @@ ProjectExplorer::Project *currentProject() void TestCodeParser::setState(State state) { m_parserState = state; + // avoid triggering parse before code model parsing has finished + if (!m_parserEnabled) + return; if (m_parserState == Disabled) { m_fullUpdatePostponed = m_partialUpdatePostponed = false; m_postponedFiles.clear(); @@ -727,6 +730,9 @@ void TestCodeParser::onAllTasksFinished(Core::Id type) if (type != CppTools::Constants::TASK_INDEX) return; m_parserEnabled = true; + // avoid illegal parser state if respective widgets became hidden while parsing + if (m_parserState == Disabled) + m_parserState = Idle; if (m_fullUpdatePostponed) updateTestTree(); else if (m_partialUpdatePostponed) { @@ -888,6 +894,9 @@ void TestCodeParser::onProFileEvaluated() QStringList files; foreach (auto projectFile, p->files) files.append(projectFile.path); + // avoid illegal parser state when respective widgets became hidden while evaluating + if (m_parserState == Disabled) + m_parserState = Idle; scanForTests(files); } }