Fix starting a usage search while another one is running.

Theoretically it could now run multiple searches in parallel, but since
a single search grabs all available threads from the pool, any search
request afterwards is queued for execution when the previous one
finished.

Task-number: QTCREATORBUG-6101
Change-Id: Ifada0ccdd1ce7cfb4aaaaa4de2db070025f91a3a
Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
This commit is contained in:
Eike Ziller
2011-12-20 10:44:13 +01:00
parent 4de9fd8dac
commit 11907bc072
2 changed files with 59 additions and 51 deletions

View File

@@ -68,9 +68,6 @@ public:
QList<int> references(CPlusPlus::Symbol *symbol, const CPlusPlus::LookupContext &context) const;
Q_SIGNALS:
void changed();
public:
void findUsages(CPlusPlus::Symbol *symbol, const CPlusPlus::LookupContext &context);
void renameUsages(CPlusPlus::Symbol *symbol, const CPlusPlus::LookupContext &context,
@@ -88,14 +85,15 @@ private Q_SLOTS:
void onReplaceButtonClicked(const QString &text, const QList<Find::SearchResultItem> &items);
private:
void findAll_helper(CPlusPlus::Symbol *symbol, const CPlusPlus::LookupContext &context);
void findAll_helper(Find::SearchResult *search,
CPlusPlus::Symbol *symbol, const CPlusPlus::LookupContext &context);
CPlusPlus::DependencyTable dependencyTable() const;
void setDependencyTable(const CPlusPlus::DependencyTable &newTable);
void createWatcher(const QFuture<CPlusPlus::Usage> &future, Find::SearchResult *search);
private:
QPointer<CPlusPlus::CppModelManagerInterface> _modelManager;
QPointer<Find::SearchResult> m_currentSearch;
QFutureWatcher<CPlusPlus::Usage> m_watcher;
QMap<QFutureWatcher<CPlusPlus::Usage> *, QPointer<Find::SearchResult> > m_watchers;
mutable QMutex m_depsLock;
CPlusPlus::DependencyTable m_deps;