summaryrefslogtreecommitdiff
path: root/src/plugins/cppeditor/cppfunctiondecldeflink.cpp
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@me.com>2013-10-10 10:26:39 +0200
committerNikolai Kosjar <nikolai.kosjar@digia.com>2013-11-12 09:24:13 +0100
commit566be0995d184cd2c3f99d006ffb7249aeff2e57 (patch)
tree132192382cda9797eb5ea05a792938f1e3148c3b /src/plugins/cppeditor/cppfunctiondecldeflink.cpp
parentd58da4bd7eb4d1f6c983a4a62e5845fe08ede539 (diff)
downloadqt-creator-566be0995d184cd2c3f99d006ffb7249aeff2e57.tar.gz
C++: Release more documents.
- fix memory leak in find-usages - do not retain snapshot in search history - when an editor is invisible for more than 2 minutes, release the backing snapshot Retaining snapshots will retain their documents, and if done for too long, the memory consumption might grow. This is especially the case when switching to a different kit (Qt version): in that case, the new versions of headers will be indexed, while the old ones stay around. Task-number: QTCREATORBUG-5583 Task-number: QTCREATORBUG-7645 Task-number: QTCREATORBUG-9842 Change-Id: I045eda1565e0a3fa702baeffaab9c12662f90289 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
Diffstat (limited to 'src/plugins/cppeditor/cppfunctiondecldeflink.cpp')
-rw-r--r--src/plugins/cppeditor/cppfunctiondecldeflink.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/plugins/cppeditor/cppfunctiondecldeflink.cpp b/src/plugins/cppeditor/cppfunctiondecldeflink.cpp
index 916dd4b6cb..29c12e7d68 100644
--- a/src/plugins/cppeditor/cppfunctiondecldeflink.cpp
+++ b/src/plugins/cppeditor/cppfunctiondecldeflink.cpp
@@ -60,13 +60,12 @@ using namespace Utils;
FunctionDeclDefLinkFinder::FunctionDeclDefLinkFinder(QObject *parent)
: QObject(parent)
{
- connect(&m_watcher, SIGNAL(finished()),
- this, SLOT(onFutureDone()));
}
void FunctionDeclDefLinkFinder::onFutureDone()
{
- QSharedPointer<FunctionDeclDefLink> link = m_watcher.result();
+ QSharedPointer<FunctionDeclDefLink> link = m_watcher->result();
+ m_watcher.reset();
if (link) {
link->linkSelection = m_scannedSelection;
link->nameSelection = m_nameSelection;
@@ -256,7 +255,9 @@ void FunctionDeclDefLinkFinder::startFindLinkAt(
result->sourceFunctionDeclarator = funcDecl;
// handle the rest in a thread
- m_watcher.setFuture(QtConcurrent::run(&findLinkHelper, result, refactoringChanges));
+ m_watcher.reset(new QFutureWatcher<QSharedPointer<FunctionDeclDefLink> >());
+ connect(m_watcher.data(), SIGNAL(finished()), this, SLOT(onFutureDone()));
+ m_watcher->setFuture(QtConcurrent::run(&findLinkHelper, result, refactoringChanges));
}
FunctionDeclDefLink::FunctionDeclDefLink()
@@ -270,10 +271,6 @@ FunctionDeclDefLink::FunctionDeclDefLink()
targetFunctionDeclarator = 0;
}
-FunctionDeclDefLink::~FunctionDeclDefLink()
-{
-}
-
bool FunctionDeclDefLink::isValid() const
{
return !linkSelection.isNull();