From d56128c315ad89dddf507b10dc4332d05cc42f91 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 15 Apr 2016 12:45:59 +0200 Subject: 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 --- src/core/url_request_custom_job.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/core/url_request_custom_job.h') diff --git a/src/core/url_request_custom_job.h b/src/core/url_request_custom_job.h index eedb41814..be1598ccc 100644 --- a/src/core/url_request_custom_job.h +++ b/src/core/url_request_custom_job.h @@ -45,17 +45,17 @@ #include QT_FORWARD_DECLARE_CLASS(QIODevice) -QT_FORWARD_DECLARE_CLASS(QWebEngineUrlSchemeHandler) namespace QtWebEngineCore { +class BrowserContextAdapter; class URLRequestCustomJobDelegate; class URLRequestCustomJobShared; // A request job that handles reading custom URL schemes class URLRequestCustomJob : public net::URLRequestJob { public: - URLRequestCustomJob(net::URLRequest *request, net::NetworkDelegate *networkDelegate, QWebEngineUrlSchemeHandler *schemeHandler); + URLRequestCustomJob(net::URLRequest *request, net::NetworkDelegate *networkDelegate, const std::string &scheme, QWeakPointer adapter); virtual void Start() Q_DECL_OVERRIDE; virtual void Kill() Q_DECL_OVERRIDE; virtual bool ReadRawData(net::IOBuffer *buf, int bufSize, int *bytesRead) Q_DECL_OVERRIDE; @@ -67,7 +67,8 @@ protected: virtual ~URLRequestCustomJob(); private: - QWebEngineUrlSchemeHandler *m_schemeHandler; + std::string m_scheme; + QWeakPointer m_adapter; URLRequestCustomJobShared *m_shared; friend class URLRequestCustomJobShared; -- cgit v1.2.3