From 51eb65ecec766d4895d49aefe2b76069f20d2f9f Mon Sep 17 00:00:00 2001 From: David Rosca Date: Mon, 24 Dec 2018 14:05:29 +0100 Subject: [PATCH] SearchToolBar: Ignore old search callbacks BUG: 401343 FIXED-IN: 3.1.0 --- src/lib/webtab/searchtoolbar.cpp | 4 ++++ src/lib/webtab/searchtoolbar.h | 1 + 2 files changed, 5 insertions(+) diff --git a/src/lib/webtab/searchtoolbar.cpp b/src/lib/webtab/searchtoolbar.cpp index e7e940ec9..7304f9bfd 100644 --- a/src/lib/webtab/searchtoolbar.cpp +++ b/src/lib/webtab/searchtoolbar.cpp @@ -120,11 +120,15 @@ void SearchToolBar::setText(const QString &text) void SearchToolBar::searchText(const QString &text) { + m_searchRequests++; QPointer guard = this; m_view->findText(text, m_findFlags, [=](bool found) { if (!guard) { return; } + if (--m_searchRequests != 0) { + return; + } if (ui->lineEdit->text().isEmpty()) found = true; diff --git a/src/lib/webtab/searchtoolbar.h b/src/lib/webtab/searchtoolbar.h index f4017783b..6abf78cc6 100644 --- a/src/lib/webtab/searchtoolbar.h +++ b/src/lib/webtab/searchtoolbar.h @@ -60,6 +60,7 @@ private: WebView* m_view; QWebEnginePage::FindFlags m_findFlags; + int m_searchRequests = 0; }; #endif // SEARCHTOOLBAR_H