Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(378)

Unified Diff: net/http/disk_cache_based_quic_server_info.cc

Issue 786123002: Update from https://crrev.com/307330 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/ftp/ftp_network_transaction.cc ('k') | net/http/disk_cache_based_quic_server_info_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
« no previous file with comments | « net/ftp/ftp_network_transaction.cc ('k') | net/http/disk_cache_based_quic_server_info_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698