forked from qt-creator/qt-creator
Clang: Fix wrong QTC_ASSERTS
If the last editor is closed, "editor" becomes a nullptr, which is valid value in this case. Change-Id: Id5f92cb4367199d782e33acc37077103e9986644 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -243,7 +243,7 @@ const QVector<ClangBackEnd::TokenInfoContainer>
|
|||||||
|
|
||||||
void ClangEditorDocumentProcessor::clearTaskHubIssues()
|
void ClangEditorDocumentProcessor::clearTaskHubIssues()
|
||||||
{
|
{
|
||||||
m_diagnosticManager.clearTaskHubIssues();
|
ClangDiagnosticManager::clearTaskHubIssues();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClangEditorDocumentProcessor::generateTaskHubIssues()
|
void ClangEditorDocumentProcessor::generateTaskHubIssues()
|
||||||
|
@@ -103,7 +103,7 @@ public:
|
|||||||
|
|
||||||
const QVector<ClangBackEnd::TokenInfoContainer> &tokenInfos() const;
|
const QVector<ClangBackEnd::TokenInfoContainer> &tokenInfos() const;
|
||||||
|
|
||||||
void clearTaskHubIssues();
|
static void clearTaskHubIssues();
|
||||||
void generateTaskHubIssues();
|
void generateTaskHubIssues();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@@ -165,14 +165,12 @@ void ModelManagerSupportClang::onCurrentEditorChanged(Core::IEditor *editor)
|
|||||||
m_communicator.updateTranslationUnitVisiblity();
|
m_communicator.updateTranslationUnitVisiblity();
|
||||||
|
|
||||||
// Update task hub issues for current CppEditorDocument
|
// Update task hub issues for current CppEditorDocument
|
||||||
QTC_ASSERT(editor, return);
|
ClangEditorDocumentProcessor::clearTaskHubIssues();
|
||||||
Core::IDocument *document = editor->document();
|
if (!editor || !editor->document() || !cppModelManager()->isCppEditor(editor))
|
||||||
QTC_ASSERT(document, return);
|
return;
|
||||||
TextEditor::TextDocument *textDocument = qobject_cast<TextEditor::TextDocument *>(document);
|
|
||||||
|
|
||||||
auto processor = ClangEditorDocumentProcessor::get(document->filePath().toString());
|
const ::Utils::FileName filePath = editor->document()->filePath();
|
||||||
processor->clearTaskHubIssues();
|
if (auto processor = ClangEditorDocumentProcessor::get(filePath.toString()))
|
||||||
if (textDocument && cppModelManager()->isCppEditor(editor))
|
|
||||||
processor->generateTaskHubIssues();
|
processor->generateTaskHubIssues();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user