From e781fe50dfb79eed4d549f5904f8c77c70ed0b8f Mon Sep 17 00:00:00 2001 From: "trop[bot]" <37223003+trop[bot]@users.noreply.github.com> Date: Mon, 28 Oct 2024 12:35:32 -0400 Subject: [PATCH] fix: crash on netlog connection error (#44419) * 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 45c21384c15..5447ac35634 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(); } }