| Index: net/http/disk_cache_based_quic_server_info.cc
|
| diff --git a/net/http/disk_cache_based_quic_server_info.cc b/net/http/disk_cache_based_quic_server_info.cc
|
| index fd3a6fa5dff4d945a1fd9132da8ad94fe3fe4b4c..6a5ee175d5187f8773a75d2c88f8dc26415e26f5 100644
|
| --- a/net/http/disk_cache_based_quic_server_info.cc
|
| +++ b/net/http/disk_cache_based_quic_server_info.cc
|
| @@ -200,12 +200,18 @@ void DiskCacheBasedQuicServerInfo::OnIOComplete(CacheOperationDataShim* unused,
|
| rv = DoLoop(rv);
|
| if (rv == ERR_IO_PENDING)
|
| return;
|
| +
|
| + base::WeakPtr<DiskCacheBasedQuicServerInfo> weak_this =
|
| + weak_factory_.GetWeakPtr();
|
| +
|
| if (!wait_for_ready_callback_.is_null()) {
|
| wait_for_data_end_time_ = base::TimeTicks::Now();
|
| RecordLastFailure();
|
| base::ResetAndReturn(&wait_for_ready_callback_).Run(rv);
|
| }
|
| - if (ready_ && !pending_write_data_.empty()) {
|
| + // |wait_for_ready_callback_| could delete the object if there is an error.
|
| + // Check if |weak_this| still exists before accessing it.
|
| + if (weak_this.get() && ready_ && !pending_write_data_.empty()) {
|
| DCHECK_EQ(NONE, state_);
|
| PersistInternal();
|
| }
|
|
|