forked from qt-creator/qt-creator
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:
@@ -539,14 +539,6 @@ void CMakeBuildConfiguration::handleParsingSucceeded()
|
|||||||
}
|
}
|
||||||
|
|
||||||
project()->handleParsingSuccess(this);
|
project()->handleParsingSuccess(this);
|
||||||
|
|
||||||
{
|
|
||||||
m_buildDirManager.resetData();
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
emitBuildTypeChanged();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<CMakeProjectNode> CMakeBuildConfiguration::generateProjectTree(
|
std::unique_ptr<CMakeProjectNode> CMakeBuildConfiguration::generateProjectTree(
|
||||||
|
@@ -269,6 +269,10 @@ void CMakeProject::updateProjectData(CMakeBuildConfiguration *bc)
|
|||||||
|
|
||||||
emit fileListChanged();
|
emit fileListChanged();
|
||||||
|
|
||||||
|
emit bc->emitBuildTypeChanged();
|
||||||
|
|
||||||
|
bc->m_buildDirManager.resetData(); // Clear remaining data
|
||||||
|
|
||||||
qCDebug(cmakeProjectLog) << "All CMake project data up to date.";
|
qCDebug(cmakeProjectLog) << "All CMake project data up to date.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -177,6 +177,8 @@ void addHeaderNodes(ProjectNode *root,
|
|||||||
QSet<Utils::FilePath> &seenHeaders,
|
QSet<Utils::FilePath> &seenHeaders,
|
||||||
const QList<const FileNode *> &allFiles)
|
const QList<const FileNode *> &allFiles)
|
||||||
{
|
{
|
||||||
|
QTC_ASSERT(root, return );
|
||||||
|
|
||||||
if (root->isEmpty())
|
if (root->isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user