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()
|
||||
{
|
||||
m_diagnosticManager.clearTaskHubIssues();
|
||||
ClangDiagnosticManager::clearTaskHubIssues();
|
||||
}
|
||||
|
||||
void ClangEditorDocumentProcessor::generateTaskHubIssues()
|
||||
|
@@ -103,7 +103,7 @@ public:
|
||||
|
||||
const QVector<ClangBackEnd::TokenInfoContainer> &tokenInfos() const;
|
||||
|
||||
void clearTaskHubIssues();
|
||||
static void clearTaskHubIssues();
|
||||
void generateTaskHubIssues();
|
||||
|
||||
public:
|
||||
|
@@ -165,14 +165,12 @@ void ModelManagerSupportClang::onCurrentEditorChanged(Core::IEditor *editor)
|
||||
m_communicator.updateTranslationUnitVisiblity();
|
||||
|
||||
// Update task hub issues for current CppEditorDocument
|
||||
QTC_ASSERT(editor, return);
|
||||
Core::IDocument *document = editor->document();
|
||||
QTC_ASSERT(document, return);
|
||||
TextEditor::TextDocument *textDocument = qobject_cast<TextEditor::TextDocument *>(document);
|
||||
ClangEditorDocumentProcessor::clearTaskHubIssues();
|
||||
if (!editor || !editor->document() || !cppModelManager()->isCppEditor(editor))
|
||||
return;
|
||||
|
||||
auto processor = ClangEditorDocumentProcessor::get(document->filePath().toString());
|
||||
processor->clearTaskHubIssues();
|
||||
if (textDocument && cppModelManager()->isCppEditor(editor))
|
||||
const ::Utils::FileName filePath = editor->document()->filePath();
|
||||
if (auto processor = ClangEditorDocumentProcessor::get(filePath.toString()))
|
||||
processor->generateTaskHubIssues();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user