diff options
author | Nikolai Kosjar <nikolai.kosjar@qt.io> | 2016-05-02 12:57:30 +0200 |
---|---|---|
committer | Nikolai Kosjar <nikolai.kosjar@qt.io> | 2016-05-03 08:03:24 +0000 |
commit | 1cbb4cc9546c58cec3c3e759b8cbc7bac67ac708 (patch) | |
tree | dcf3d9743fa9981e9ba544bb8710d1cff57c7470 | |
parent | 506fc40a319bc785cb6fadfb0598aa9a3d0213ae (diff) | |
download | qt-creator-1cbb4cc9546c58cec3c3e759b8cbc7bac67ac708.tar.gz |
QbsProjectManager: Fix SOFT ASSERT: "future.isFinished()"
...in file qbsproject.cpp, line 940.
The assert can be triggered with e.g.:
1. Load a bigger qbs project, e.g. qtcreator.qbs.
2. Trigger project build as soon as possible.
3. Cancel the "Parsing C/C++" operation.
4. Wait until the build finished and the assert occurs.
This happens because CppModelManager::updateProjectInfo() since
commit 536ccc8a8742b38e75547d98ce457b0b90af3ee7
CppTools: Fix incompletely indexed project
will check whether the previous indexer run was canceled or not. If it
was canceled, it will trigger a full-reindexing of the project.
Updating the compiler call data is a special case and it should never
trigger an indexing operation, so introduce a dedicated update function
for this case.
Change-Id: I456945ccf2bf697aaeada572ed87f3acb21a5eaf
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
-rw-r--r-- | src/plugins/cpptools/cppmodelmanager.cpp | 13 | ||||
-rw-r--r-- | src/plugins/cpptools/cppmodelmanager.h | 4 | ||||
-rw-r--r-- | src/plugins/qbsprojectmanager/qbsproject.cpp | 4 |
3 files changed, 17 insertions, 4 deletions
diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp index 2ffd37c14e..08ee406fc8 100644 --- a/src/plugins/cpptools/cppmodelmanager.cpp +++ b/src/plugins/cpptools/cppmodelmanager.cpp @@ -900,6 +900,19 @@ QFuture<void> CppModelManager::updateProjectInfo(const ProjectInfo &newProjectIn return indexerFuture; } +ProjectInfo CppModelManager::updateCompilerCallDataForProject( + ProjectExplorer::Project *project, + ProjectInfo::CompilerCallData &compilerCallData) +{ + QMutexLocker locker(&d->m_projectMutex); + + ProjectInfo projectInfo = d->m_projectToProjectsInfo.value(project, ProjectInfo()); + projectInfo.setCompilerCallData(compilerCallData); + d->m_projectToProjectsInfo.insert(project, projectInfo); + + return projectInfo; +} + ProjectPart::Ptr CppModelManager::projectPartForId(const QString &projectPartId) const { return d->m_projectPartIdToProjectProjectPart.value(projectPartId); diff --git a/src/plugins/cpptools/cppmodelmanager.h b/src/plugins/cpptools/cppmodelmanager.h index 3a42c65034..2e296ef639 100644 --- a/src/plugins/cpptools/cppmodelmanager.h +++ b/src/plugins/cpptools/cppmodelmanager.h @@ -29,6 +29,7 @@ #include "cpptools_global.h" #include "cppmodelmanagersupport.h" +#include "projectinfo.h" #include "projectpart.h" #include "projectpartheaderpath.h" @@ -56,7 +57,6 @@ class CppEditorDocumentHandle; class CppIndexingSupport; class SymbolFinder; class WorkingCopy; -class ProjectInfo; namespace Internal { class CppSourceProcessor; @@ -95,6 +95,8 @@ public: QList<ProjectInfo> projectInfos() const; ProjectInfo projectInfo(ProjectExplorer::Project *project) const; QFuture<void> updateProjectInfo(const ProjectInfo &newProjectInfo); + ProjectInfo updateCompilerCallDataForProject(ProjectExplorer::Project *project, + ProjectInfo::CompilerCallData &compilerCallData); /// \return The project part with the given project file ProjectPart::Ptr projectPartForId(const QString &projectPartId) const; diff --git a/src/plugins/qbsprojectmanager/qbsproject.cpp b/src/plugins/qbsprojectmanager/qbsproject.cpp index 51928b7a87..b9f6556d10 100644 --- a/src/plugins/qbsprojectmanager/qbsproject.cpp +++ b/src/plugins/qbsprojectmanager/qbsproject.cpp @@ -935,9 +935,7 @@ void QbsProject::updateCppCompilerCallData() } } - m_codeModelProjectInfo.setCompilerCallData(data); - const QFuture<void> future = modelManager->updateProjectInfo(m_codeModelProjectInfo); - QTC_CHECK(future.isFinished()); // No reparse of files expected + m_codeModelProjectInfo = modelManager->updateCompilerCallDataForProject(this, data); } void QbsProject::updateQmlJsCodeModel() |