CMake: Fix race/crash on project open

When the filesystem scan takes longer than the cmake parsing, then
resetData() was called on BuildDirManager by the CMakeBuildConfiguration
before the CMakeProject had requested its data.

Move some code back into CMakeProject to resolve this issue.

Change-Id: Ib21bdd63fdca79c2ad39a7e060df438b456700b4
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Tobias Hunger
2019-08-09 14:40:06 +02:00
parent 09530d6dcc
commit eb2f49c398
3 changed files with 6 additions and 8 deletions

View File

@@ -539,14 +539,6 @@ void CMakeBuildConfiguration::handleParsingSucceeded()
}
project()->handleParsingSuccess(this);
{
m_buildDirManager.resetData();
}
{
emitBuildTypeChanged();
}
}
std::unique_ptr<CMakeProjectNode> CMakeBuildConfiguration::generateProjectTree(

View File

@@ -269,6 +269,10 @@ void CMakeProject::updateProjectData(CMakeBuildConfiguration *bc)
emit fileListChanged();
emit bc->emitBuildTypeChanged();
bc->m_buildDirManager.resetData(); // Clear remaining data
qCDebug(cmakeProjectLog) << "All CMake project data up to date.";
}

View File

@@ -177,6 +177,8 @@ void addHeaderNodes(ProjectNode *root,
QSet<Utils::FilePath> &seenHeaders,
const QList<const FileNode *> &allFiles)
{
QTC_ASSERT(root, return );
if (root->isEmpty())
return;