diff options
author | Jüri Valdmann <juri.valdmann@qt.io> | 2018-04-18 14:34:39 +0200 |
---|---|---|
committer | Jüri Valdmann <juri.valdmann@qt.io> | 2018-04-19 12:12:47 +0000 |
commit | ad6e1079a1edfff48bf18c25718f65a1d9f8008f (patch) | |
tree | 23c6ec1c55ed9909f724a5a231caa15de795918e | |
parent | b7e5722cce95730004ef6cb9f4aabde5bbd5685d (diff) |
RequestController: Fix pure virtual method call crash
Fixes bug introduced by 4b30d82f05064723b9c3684e1c16ae0cf9d71baa where somebody
had the bright idea to call reject() from RequestController's destructor. Of
course, at this point the subclasses have already been destructed and a pure
virtual method call error is triggered.
Change-Id: Ida581285828c592a76f9ca981ec780f2711d298e
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
-rw-r--r-- | src/core/quota_request_controller_impl.cpp | 5 | ||||
-rw-r--r-- | src/core/quota_request_controller_impl.h | 2 | ||||
-rw-r--r-- | src/core/register_protocol_handler_request_controller_impl.cpp | 5 | ||||
-rw-r--r-- | src/core/register_protocol_handler_request_controller_impl.h | 2 | ||||
-rw-r--r-- | src/core/request_controller.h | 5 |
5 files changed, 15 insertions, 4 deletions
diff --git a/src/core/quota_request_controller_impl.cpp b/src/core/quota_request_controller_impl.cpp index ee94e1cdd..a18ad761d 100644 --- a/src/core/quota_request_controller_impl.cpp +++ b/src/core/quota_request_controller_impl.cpp @@ -54,6 +54,11 @@ QuotaRequestControllerImpl::QuotaRequestControllerImpl( , m_callback(callback) {} +QuotaRequestControllerImpl::~QuotaRequestControllerImpl() +{ + reject(); +} + void QuotaRequestControllerImpl::accepted() { m_context->dispatchCallbackOnIOThread(m_callback, QuotaPermissionContextQt::QUOTA_PERMISSION_RESPONSE_ALLOW); diff --git a/src/core/quota_request_controller_impl.h b/src/core/quota_request_controller_impl.h index dacdce72f..5814895f3 100644 --- a/src/core/quota_request_controller_impl.h +++ b/src/core/quota_request_controller_impl.h @@ -52,6 +52,8 @@ public: const content::StorageQuotaParams ¶ms, const content::QuotaPermissionContext::PermissionCallback &callback); + ~QuotaRequestControllerImpl(); + protected: void accepted() override; void rejected() override; diff --git a/src/core/register_protocol_handler_request_controller_impl.cpp b/src/core/register_protocol_handler_request_controller_impl.cpp index 1e3a15c93..0f24d8812 100644 --- a/src/core/register_protocol_handler_request_controller_impl.cpp +++ b/src/core/register_protocol_handler_request_controller_impl.cpp @@ -54,6 +54,11 @@ RegisterProtocolHandlerRequestControllerImpl::RegisterProtocolHandlerRequestCont , m_handler(handler) {} +RegisterProtocolHandlerRequestControllerImpl::~RegisterProtocolHandlerRequestControllerImpl() +{ + reject(); +} + ProtocolHandlerRegistry *RegisterProtocolHandlerRequestControllerImpl::protocolHandlerRegistry() { content::WebContents *webContents = web_contents(); diff --git a/src/core/register_protocol_handler_request_controller_impl.h b/src/core/register_protocol_handler_request_controller_impl.h index 5ad64210c..64f229ac4 100644 --- a/src/core/register_protocol_handler_request_controller_impl.h +++ b/src/core/register_protocol_handler_request_controller_impl.h @@ -57,6 +57,8 @@ public: content::WebContents *webContents, ProtocolHandler handler); + ~RegisterProtocolHandlerRequestControllerImpl(); + protected: void accepted() override; void rejected() override; diff --git a/src/core/request_controller.h b/src/core/request_controller.h index a15c601d7..ffcf9edac 100644 --- a/src/core/request_controller.h +++ b/src/core/request_controller.h @@ -70,10 +70,7 @@ public: } } - virtual ~RequestController() - { - reject(); - } + virtual ~RequestController() {} protected: virtual void accepted() = 0; |