forked from qt-creator/qt-creator
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 <david.schulz@theqtcompany.com>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user