1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 18:56:34 +01:00

SearchToolBar: Ignore old search callbacks

BUG: 401343
FIXED-IN: 3.1.0
This commit is contained in:
David Rosca 2018-12-24 14:05:29 +01:00
parent 9e7011cbed
commit 51eb65ecec
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8
2 changed files with 5 additions and 0 deletions

View File

@ -120,11 +120,15 @@ void SearchToolBar::setText(const QString &text)
void SearchToolBar::searchText(const QString &text) void SearchToolBar::searchText(const QString &text)
{ {
m_searchRequests++;
QPointer<SearchToolBar> guard = this; QPointer<SearchToolBar> guard = this;
m_view->findText(text, m_findFlags, [=](bool found) { m_view->findText(text, m_findFlags, [=](bool found) {
if (!guard) { if (!guard) {
return; return;
} }
if (--m_searchRequests != 0) {
return;
}
if (ui->lineEdit->text().isEmpty()) if (ui->lineEdit->text().isEmpty())
found = true; found = true;

View File

@ -60,6 +60,7 @@ private:
WebView* m_view; WebView* m_view;
QWebEnginePage::FindFlags m_findFlags; QWebEnginePage::FindFlags m_findFlags;
int m_searchRequests = 0;
}; };
#endif // SEARCHTOOLBAR_H #endif // SEARCHTOOLBAR_H