summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cpptoolseditorsupport.cpp
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@digia.com>2013-12-11 15:19:54 +0100
committerEike Ziller <eike.ziller@digia.com>2014-02-05 15:42:46 +0100
commit58af02f0746befaf84f77e70aff7f9521f68b15f (patch)
tree502287f7ed91d92e78f6cb23f8c49aafc09b7ec6 /src/plugins/cpptools/cpptoolseditorsupport.cpp
parent408901273500a64438bd168864300f7877877a6b (diff)
downloadqt-creator-58af02f0746befaf84f77e70aff7f9521f68b15f.tar.gz
C++: release more futures.
The CPPEditorWidget retained two futures, as did the attached future watchers retained them too. Together, each future and the watcher held on to a complete snapshot that would only get released when another future was set. This could result into retaining old snapshots in editors that were invisible/unused for long. Change-Id: I1133e857c620437b4a69b9dad468f6bd458304b8 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Diffstat (limited to 'src/plugins/cpptools/cpptoolseditorsupport.cpp')
-rw-r--r--src/plugins/cpptools/cpptoolseditorsupport.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/plugins/cpptools/cpptoolseditorsupport.cpp b/src/plugins/cpptools/cpptoolseditorsupport.cpp
index 2638a127ce..6a31f98f85 100644
--- a/src/plugins/cpptools/cpptoolseditorsupport.cpp
+++ b/src/plugins/cpptools/cpptoolseditorsupport.cpp
@@ -390,7 +390,7 @@ void CppEditorSupport::startHighlighting()
m_highlighter = m_highlightingSupport->highlightingFuture(doc, snapshot);
m_lastHighlightRevision = revision;
- emit highlighterStarted(&m_highlighter, m_lastHighlightRevision);
+ emit highlighterStarted(m_highlighter, m_lastHighlightRevision);
} else {
const unsigned revision = currentSource(false).revision;
if (m_lastHighlightRevision == revision)
@@ -400,7 +400,7 @@ void CppEditorSupport::startHighlighting()
static const Document::Ptr dummyDoc;
static const Snapshot dummySnapshot;
m_highlighter = m_highlightingSupport->highlightingFuture(dummyDoc, dummySnapshot);
- emit highlighterStarted(&m_highlighter, m_lastHighlightRevision);
+ emit highlighterStarted(m_highlighter, m_lastHighlightRevision);
}
}
@@ -500,6 +500,8 @@ void CppEditorSupport::onCurrentEditorChanged()
void CppEditorSupport::releaseResources()
{
+ m_highlighter.cancel();
+ m_highlighter = QFuture<TextEditor::HighlightingResult>();
snapshotUpdater()->releaseSnapshot();
QMutexLocker semanticLocker(&m_lastSemanticInfoLock);
m_lastSemanticInfo = SemanticInfo();