diff --git a/src/plugins/cppeditor/cppuseselectionsupdater.cpp b/src/plugins/cppeditor/cppuseselectionsupdater.cpp index a55999ecdc5..cfc8bce8071 100644 --- a/src/plugins/cppeditor/cppuseselectionsupdater.cpp +++ b/src/plugins/cppeditor/cppuseselectionsupdater.cpp @@ -255,7 +255,9 @@ void CppUseSelectionsUpdater::update(CallType callType) { CppEditorWidget *cppEditorWidget = qobject_cast(m_editorWidget); QTC_ASSERT(cppEditorWidget, return); - QTC_CHECK(cppEditorWidget->isSemanticInfoValidExceptLocalUses()); + if (!cppEditorWidget->isSemanticInfoValidExceptLocalUses()) + return; + const CppTools::SemanticInfo semanticInfo = cppEditorWidget->semanticInfo(); const Document::Ptr document = semanticInfo.doc; const Snapshot snapshot = semanticInfo.snapshot; @@ -296,7 +298,6 @@ void CppUseSelectionsUpdater::onFindUsesFinished() m_findUsesWatcher.reset(); m_document.reset(); - m_snapshot = Snapshot(); } bool CppUseSelectionsUpdater::handleMacroCase(const Document::Ptr document) @@ -342,7 +343,6 @@ void CppUseSelectionsUpdater::handleSymbolCaseAsynchronously(const Document::Ptr const Snapshot &snapshot) { m_document = document; - m_snapshot = snapshot; if (m_findUsesWatcher) m_findUsesWatcher->cancel(); @@ -359,11 +359,14 @@ void CppUseSelectionsUpdater::handleSymbolCaseAsynchronously(const Document::Ptr void CppUseSelectionsUpdater::handleSymbolCaseSynchronously(const Document::Ptr document, const Snapshot &snapshot) { + const CPlusPlus::Document::Ptr previousDocument = m_document; m_document = document; const Params params = Params(m_editorWidget->textCursor(), document, snapshot); const UseSelectionsResult result = findUses(params); processSymbolCaseResults(result); + + m_document = previousDocument; } void CppUseSelectionsUpdater::processSymbolCaseResults(const UseSelectionsResult &result) diff --git a/src/plugins/cppeditor/cppuseselectionsupdater.h b/src/plugins/cppeditor/cppuseselectionsupdater.h index bb615760f1e..2eb33e1035b 100644 --- a/src/plugins/cppeditor/cppuseselectionsupdater.h +++ b/src/plugins/cppeditor/cppuseselectionsupdater.h @@ -110,7 +110,6 @@ private: QTimer m_timer; CPlusPlus::Document::Ptr m_document; - CPlusPlus::Snapshot m_snapshot; QScopedPointer> m_findUsesWatcher; int m_findUsesRevision;