fix: crash on netlog connection error (#44419)

* fix: crash on netlog connection error

Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>

* refactor: remove default PromiseBase constructor

Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>

* Revert "refactor: remove default PromiseBase constructor"

This reverts commit 9292324a0d5f9e63ba8f73f63dfff1d48eb2f38f.

Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>

* remove dcheck

Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>
This commit is contained in:
trop[bot] 2024-10-28 12:35:32 -04:00 committed by GitHub
parent 1a2015c87d
commit e781fe50df
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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();
}
}