From ec070e57e055ad5437e53981105295502483e0e4 Mon Sep 17 00:00:00 2001 From: "trop[bot]" <37223003+trop[bot]@users.noreply.github.com> Date: Mon, 28 Oct 2024 14:37:58 +0100 Subject: [PATCH] fix: crash on netlog connection error (#44420) * fix: crash on netlog connection error Co-authored-by: Samuel Maddock * refactor: remove default PromiseBase constructor Co-authored-by: Samuel Maddock * Revert "refactor: remove default PromiseBase constructor" This reverts commit 9292324a0d5f9e63ba8f73f63dfff1d48eb2f38f. Co-authored-by: Samuel Maddock * remove dcheck Co-authored-by: Samuel Maddock --------- Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Samuel Maddock --- shell/browser/api/electron_api_net_log.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/shell/browser/api/electron_api_net_log.cc b/shell/browser/api/electron_api_net_log.cc index 2ea08604da8..394d45b5484 100644 --- a/shell/browser/api/electron_api_net_log.cc +++ b/shell/browser/api/electron_api_net_log.cc @@ -166,6 +166,7 @@ void NetLog::StartNetLogAfterCreateFile(net::NetLogCaptureMode capture_mode, std::move(*pending_start_promise_) .RejectWithErrorMessage( base::File::ErrorToString(output_file.error_details())); + pending_start_promise_.reset(); net_log_exporter_.reset(); return; } @@ -178,6 +179,7 @@ void NetLog::StartNetLogAfterCreateFile(net::NetLogCaptureMode capture_mode, void NetLog::NetLogStarted(int32_t error) { DCHECK(pending_start_promise_); ResolvePromiseWithNetError(std::move(*pending_start_promise_), error); + pending_start_promise_.reset(); } void NetLog::OnConnectionError() { @@ -185,6 +187,7 @@ void NetLog::OnConnectionError() { if (pending_start_promise_) { std::move(*pending_start_promise_) .RejectWithErrorMessage("Failed to start net log exporter"); + pending_start_promise_.reset(); } }