forked from qt-creator/qt-creator
Clang: Fix race condition when closing a project
...which could lead to undesired asserts:
SOFT ASSERT: "!"Got ProjectPartsDoNotExistMessage"" in file
clangbackendipcintegration.cpp, line 184
Change-Id: If6d67b9f617394ce8f72e7e56699423d47879688
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
This commit is contained in:
@@ -217,15 +217,22 @@ ClangEditorDocumentProcessor *ClangEditorDocumentProcessor::get(const QString &f
|
|||||||
return qobject_cast<ClangEditorDocumentProcessor *>(BaseEditorDocumentProcessor::get(filePath));
|
return qobject_cast<ClangEditorDocumentProcessor *>(BaseEditorDocumentProcessor::get(filePath));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool isProjectPartLoadedOrIsFallback(CppTools::ProjectPart::Ptr projectPart)
|
||||||
|
{
|
||||||
|
return projectPart
|
||||||
|
&& (projectPart->id().isEmpty() || ClangCodeModel::Utils::isProjectPartValid(projectPart));
|
||||||
|
}
|
||||||
|
|
||||||
void ClangEditorDocumentProcessor::updateProjectPartAndTranslationUnitForEditor()
|
void ClangEditorDocumentProcessor::updateProjectPartAndTranslationUnitForEditor()
|
||||||
{
|
{
|
||||||
const CppTools::ProjectPart::Ptr projectPart = m_parser->projectPart();
|
const CppTools::ProjectPart::Ptr projectPart = m_parser->projectPart();
|
||||||
QTC_ASSERT(projectPart, return);
|
|
||||||
|
|
||||||
|
if (isProjectPartLoadedOrIsFallback(projectPart)) {
|
||||||
updateTranslationUnitForEditor(*projectPart.data());
|
updateTranslationUnitForEditor(*projectPart.data());
|
||||||
requestDiagnostics(*projectPart.data());
|
requestDiagnostics(*projectPart.data());
|
||||||
|
|
||||||
m_projectPart = projectPart;
|
m_projectPart = projectPart;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClangEditorDocumentProcessor::onParserFinished()
|
void ClangEditorDocumentProcessor::onParserFinished()
|
||||||
|
|||||||
Reference in New Issue
Block a user