diff options
Diffstat (limited to 'src/plugins/coreplugin/locator/locatorwidget.cpp')
-rw-r--r-- | src/plugins/coreplugin/locator/locatorwidget.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/plugins/coreplugin/locator/locatorwidget.cpp b/src/plugins/coreplugin/locator/locatorwidget.cpp index 07e80e557f..8d3ef982f9 100644 --- a/src/plugins/coreplugin/locator/locatorwidget.cpp +++ b/src/plugins/coreplugin/locator/locatorwidget.cpp @@ -478,12 +478,18 @@ QList<ILocatorFilter *> LocatorWidget::filtersFor(const QString &text, QString & void LocatorWidget::updateCompletionList(const QString &text) { m_updateRequested = true; + if (m_entriesWatcher->future().isRunning()) { + // Cancel the old future. We may not just block the UI thread to wait for the search to + // actually cancel, so try again when the finshed signal of the watcher ends up in + // updateEntries() (which will call updateCompletionList again with the + // requestedCompletionText) + m_requestedCompletionText = text; + m_entriesWatcher->future().cancel(); + return; + } + QString searchText; const QList<ILocatorFilter *> filters = filtersFor(text, searchText); - - // cancel the old future - m_entriesWatcher->future().cancel(); - QFuture<LocatorFilterEntry> future = QtConcurrent::run(runSearch, filters, searchText); m_entriesWatcher->setFuture(future); } @@ -492,8 +498,9 @@ void LocatorWidget::updateEntries() { m_updateRequested = false; if (m_entriesWatcher->future().isCanceled()) { - // reset to usable state - m_acceptRequested = false; + const QString text = m_requestedCompletionText; + m_requestedCompletionText.clear(); + updateCompletionList(text); return; } |