summaryrefslogtreecommitdiffstats
path: root/src/core/custom_protocol_handler.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-04-15 12:45:59 +0200
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-04-20 14:32:58 +0000
commitd56128c315ad89dddf507b10dc4332d05cc42f91 (patch)
tree65a2b340c82350d95cb29a1576e1053d6ba84a0c /src/core/custom_protocol_handler.cpp
parent5b8aad9fa24caeb50ff3640d01590a15ee4e23d8 (diff)
Improve thread-safety of custom scheme handlers
Avoids accessing the QWebEngineUrlSchemeHandler from any other thread than the UI thread, since it may be deleted at any time on the UI thread. Change-Id: Icb4331b3c36f6f619a9fd975d155a9fd608dc5e9 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Diffstat (limited to 'src/core/custom_protocol_handler.cpp')
-rw-r--r--src/core/custom_protocol_handler.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/core/custom_protocol_handler.cpp b/src/core/custom_protocol_handler.cpp
index fd1a4de41..5b58694a1 100644
--- a/src/core/custom_protocol_handler.cpp
+++ b/src/core/custom_protocol_handler.cpp
@@ -43,8 +43,8 @@
namespace QtWebEngineCore {
-CustomProtocolHandler::CustomProtocolHandler(QWebEngineUrlSchemeHandler *schemeHandler)
- : m_schemeHandler(schemeHandler)
+CustomProtocolHandler::CustomProtocolHandler(QWeakPointer<const BrowserContextAdapter> adapter)
+ : m_adapter(adapter)
{
}
@@ -53,7 +53,7 @@ net::URLRequestJob *CustomProtocolHandler::MaybeCreateJob(net::URLRequest *reque
if (!networkDelegate)
return new net::URLRequestErrorJob(request, Q_NULLPTR, net::ERR_ACCESS_DENIED);
- return new URLRequestCustomJob(request, networkDelegate, m_schemeHandler);
+ return new URLRequestCustomJob(request, networkDelegate, request->url().scheme(), m_adapter);
}
} // namespace