forked from qt-creator/qt-creator
Clang: Unregister file with project immediately on project close
Ensure that first the editors unregister with the removed project part,
then unregister the project part.
This makes testing and following the message logs easier.
It also fixes the following race condition:
* Unload project of opened file
* Immediately close the editor before a new project part is calculated
==> The editor is closed, but the translation unit is not properly
unregistered.
Change-Id: I618930d221323435ba60ac6c051380bccc9fdaf1
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
This commit is contained in:
@@ -94,9 +94,6 @@ ClangEditorDocumentProcessor::ClangEditorDocumentProcessor(
|
||||
connect(&m_builtinProcessor, &CppTools::BuiltinEditorDocumentProcessor::semanticInfoUpdated,
|
||||
this, &ClangEditorDocumentProcessor::semanticInfoUpdated);
|
||||
|
||||
connect(CppTools::CppModelManager::instance(), &CppTools::CppModelManager::projectPartsRemoved,
|
||||
this, &ClangEditorDocumentProcessor::onProjectPartsRemoved);
|
||||
|
||||
m_semanticHighlighter.setHighlightingRunner(
|
||||
[this]() -> QFuture<TextEditor::HighlightingResult> {
|
||||
const int firstLine = 1;
|
||||
@@ -184,6 +181,11 @@ CppTools::ProjectPart::Ptr ClangEditorDocumentProcessor::projectPart() const
|
||||
return m_projectPart;
|
||||
}
|
||||
|
||||
void ClangEditorDocumentProcessor::clearProjectPart()
|
||||
{
|
||||
m_projectPart.clear();
|
||||
}
|
||||
|
||||
void ClangEditorDocumentProcessor::updateCodeWarnings(const QVector<ClangBackEnd::DiagnosticContainer> &diagnostics,
|
||||
uint documentRevision)
|
||||
{
|
||||
@@ -250,12 +252,6 @@ void ClangEditorDocumentProcessor::onParserFinished()
|
||||
updateProjectPartAndTranslationUnitForEditor();
|
||||
}
|
||||
|
||||
void ClangEditorDocumentProcessor::onProjectPartsRemoved(const QStringList &projectPartIds)
|
||||
{
|
||||
if (m_projectPart && projectPartIds.contains(m_projectPart->id()))
|
||||
m_projectPart.clear();
|
||||
}
|
||||
|
||||
void ClangEditorDocumentProcessor::updateTranslationUnitForEditor(CppTools::ProjectPart &projectPart)
|
||||
{
|
||||
QTC_ASSERT(m_modelManagerSupport, return);
|
||||
|
||||
Reference in New Issue
Block a user