From 8938addc5ca6b74e602fcb2496275cb8554376ee Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Mon, 20 Jul 2015 12:09:32 +0200 Subject: [PATCH] Clang: Remove QTC_ASSERT If an editor is opened, the semantic highlighter is triggered twice: 1) From ClangEditorDocumentProcessor::onParserFinished 2) From CppEditorDocument::applyFontSettings Caller 1) is expected, it creates an m_unit. However, if threads are scheduled differently, the semantic highlighter triggered from 2) will encounter an invalid m_unit. I'm not sure whether the call to 2) is correct at all. Change-Id: Ia6ff2852e7d38418ebb01edc3eca3680fac1820a Reviewed-by: Marco Bubke --- src/plugins/clangcodemodel/semanticmarker.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/clangcodemodel/semanticmarker.cpp b/src/plugins/clangcodemodel/semanticmarker.cpp index 71a5abc03d6..cb5d0b71f43 100644 --- a/src/plugins/clangcodemodel/semanticmarker.cpp +++ b/src/plugins/clangcodemodel/semanticmarker.cpp @@ -333,9 +333,8 @@ QList SemanticMarker::sourceMarkersInRange(unsigned firstLine, unsigned lastLine) { QList result; - QTC_ASSERT(m_unit, return result); - if (!m_unit->isLoaded()) + if (!m_unit || !m_unit->isLoaded()) return result; // Highlighting called asynchronously, and a few lines at the end can be deleted for this time.