diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2022-04-06 15:32:17 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-05-26 15:58:00 +0000 |
commit | 572277538333e998e4bdfea74acb395333d3d7c8 (patch) | |
tree | 72995131177809faf188a91af42b5939680138dd | |
parent | c7e716ef1ffd63a8ab1f4dbf879230849eb3b505 (diff) |
Fix leak if loader error is seen first5.15.10
For some reason the proxied_loader_receiver can still be bound
in this case.
Change-Id: If0bbe181eca5de41e82eebaced412361fe12fb40
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
(cherry picked from commit ffb831d9896dcdd3d469fdbeee407d96d631dbda)
(cherry picked from commit 79943b157ef381e5953f34f8e03049f2eecd6eb5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/core/net/proxying_url_loader_factory_qt.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/core/net/proxying_url_loader_factory_qt.cpp b/src/core/net/proxying_url_loader_factory_qt.cpp index 883811637..a9b774086 100644 --- a/src/core/net/proxying_url_loader_factory_qt.cpp +++ b/src/core/net/proxying_url_loader_factory_qt.cpp @@ -167,6 +167,8 @@ public: const uint32_t options_; bool allowed_cors_ = true; + bool loader_error_seen_ = false; + // If the |target_loader_| called OnComplete with an error this stores it. // That way the destructor can send it to OnReceivedError if safe browsing // error didn't occur. @@ -396,6 +398,7 @@ void InterceptedRequest::ContinueAfterIntercept() } if (!target_loader_ && target_factory_) { + loader_error_seen_ = false; target_factory_->CreateLoaderAndStart(target_loader_.BindNewPipeAndPassReceiver(), routing_id_, request_id_, options_, request_, proxied_client_receiver_.BindNewPipeAndPassRemote(), traffic_annotation_); @@ -501,6 +504,8 @@ void InterceptedRequest::OnURLLoaderError(uint32_t custom_reason, const std::str // If CallOnComplete was already called, then this object is ready to be deleted. if (!target_client_) delete this; + else + loader_error_seen_ = true; } void InterceptedRequest::CallOnComplete(const network::URLLoaderCompletionStatus &status, bool wait_for_loader_error) @@ -514,7 +519,7 @@ void InterceptedRequest::CallOnComplete(const network::URLLoaderCompletionStatus if (target_client_) target_client_->OnComplete(status); - if (proxied_loader_receiver_.is_bound() && wait_for_loader_error) { + if (proxied_loader_receiver_.is_bound() && wait_for_loader_error && !loader_error_seen_) { // Since the original client is gone no need to continue loading the // request. proxied_client_receiver_.reset(); |