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>
This commit is contained in:
Erik Verbruggen
2013-10-10 10:26:39 +02:00
committed by Nikolai Kosjar
parent d58da4bd7e
commit 566be0995d
10 changed files with 89 additions and 20 deletions

View File

@@ -67,7 +67,7 @@ private slots:
private:
QTextCursor m_scannedSelection;
QTextCursor m_nameSelection;
QFutureWatcher<QSharedPointer<FunctionDeclDefLink> > m_watcher;
QScopedPointer<QFutureWatcher<QSharedPointer<FunctionDeclDefLink> > > m_watcher;
};
class FunctionDeclDefLink
@@ -75,8 +75,6 @@ class FunctionDeclDefLink
Q_DECLARE_TR_FUNCTIONS(CppEditor::Internal::FunctionDeclDefLink)
Q_DISABLE_COPY(FunctionDeclDefLink)
public:
~FunctionDeclDefLink();
class Marker {};
bool isValid() const;