summaryrefslogtreecommitdiffstats
path: root/src/core/web_contents_delegate_qt.cpp
diff options
context:
space:
mode:
authorJocelyn Turcotte <jocelyn.turcotte@digia.com>2014-08-13 11:13:28 +0200
committerJocelyn Turcotte <jocelyn.turcotte@digia.com>2014-08-15 11:14:15 +0200
commit423b399a3336ed5832ac12fe0bb9c4c3eebc1c82 (patch)
tree5b4abc470dbeec3948cfe18bff91f48b06b9937f /src/core/web_contents_delegate_qt.cpp
parenteb7e970eb03dfcc73c39544f4eca3a72782f4a08 (diff)
Fix uncalled callbacks with findText
Calling findText successively might prevent the previous pending FindReply to be sent, which would leak the callback on the application side. This would cause a crash in qupzilla since we empty all pending callbacks in the QWebEnginePage's destructor to catch this kind of issue. This also renames lastRequestId to nextRequestId to make it clear that this is the ID generator for everything, including findText, and that lastFindRequestId is only a tracker. Change-Id: Ia78d553a58ed31af7237aad8772fa9828560c6d4 Reviewed-by: Andras Becsi <andras.becsi@digia.com>
Diffstat (limited to 'src/core/web_contents_delegate_qt.cpp')
-rw-r--r--src/core/web_contents_delegate_qt.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp
index b3c1cd70b..08f11cf5c 100644
--- a/src/core/web_contents_delegate_qt.cpp
+++ b/src/core/web_contents_delegate_qt.cpp
@@ -76,6 +76,7 @@ static WebContentsAdapterClient::JavaScriptConsoleMessageLevel mapToJavascriptCo
WebContentsDelegateQt::WebContentsDelegateQt(content::WebContents *webContents, WebContentsAdapterClient *adapterClient)
: m_viewClient(adapterClient)
+ , m_lastReceivedFindReply(0)
{
webContents->SetDelegate(this);
Observe(webContents);
@@ -239,8 +240,10 @@ void WebContentsDelegateQt::FindReply(content::WebContents *source, int request_
Q_UNUSED(source)
Q_UNUSED(selection_rect)
Q_UNUSED(active_match_ordinal)
- if (final_update)
+ if (final_update) {
+ m_lastReceivedFindReply = request_id;
m_viewClient->didFindText(request_id, number_of_matches);
+ }
}
void WebContentsDelegateQt::RequestMediaAccessPermission(content::WebContents *web_contents, const content::MediaStreamRequest &request, const content::MediaResponseCallback &callback)