Commit 26c0d6ab authored by Nikolai Kosjar's avatar Nikolai Kosjar

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: default avatarMarco Bubke <marco.bubke@theqtcompany.com>
parent 88b167c5
......@@ -217,15 +217,22 @@ ClangEditorDocumentProcessor *ClangEditorDocumentProcessor::get(const QString &f
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()
{
const CppTools::ProjectPart::Ptr projectPart = m_parser->projectPart();
QTC_ASSERT(projectPart, return);
updateTranslationUnitForEditor(*projectPart.data());
requestDiagnostics(*projectPart.data());
if (isProjectPartLoadedOrIsFallback(projectPart)) {
updateTranslationUnitForEditor(*projectPart.data());
requestDiagnostics(*projectPart.data());
m_projectPart = projectPart;
m_projectPart = projectPart;
}
}
void ClangEditorDocumentProcessor::onParserFinished()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment