summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-16 22:40:32 +0000
committerrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-16 22:40:32 +0000
commit09bcf66bb3686a5b0a13b3ace55f83c3c0a2a574 (patch)
tree053cb0f69ea60e38dc7cff3edd1f112acfa6045b
parentc54dd6a7cbfd38a000b6642f969c1a888cf6649c (diff)
downloadchromium_src-09bcf66bb3686a5b0a13b3ace55f83c3c0a2a574.zip
chromium_src-09bcf66bb3686a5b0a13b3ace55f83c3c0a2a574.tar.gz
chromium_src-09bcf66bb3686a5b0a13b3ace55f83c3c0a2a574.tar.bz2
Disk Cache: If there are no abort_callbacks, we should not
call DoAbortCallbacks because the SparseControl object may be gone already (after calling DoUserCallback). BUG= 96479 TEST=none (asan should be happy). Review URL: http://codereview.chromium.org/7919021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@101587 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--net/disk_cache/sparse_control.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/net/disk_cache/sparse_control.cc b/net/disk_cache/sparse_control.cc
index 9e1ac9c..3043d2b 100644
--- a/net/disk_cache/sparse_control.cc
+++ b/net/disk_cache/sparse_control.cc
@@ -673,7 +673,7 @@ void SparseControl::DoChildrenIO() {
entry_->net_log().EndEvent(GetSparseEventType(operation_), NULL);
}
if (pending_)
- DoUserCallback();
+ DoUserCallback(); // Don't touch this object after this point.
}
}
@@ -819,8 +819,14 @@ void SparseControl::OnChildIOCompleted(int result) {
entry_->net_log().AddEvent(net::NetLog::TYPE_CANCELLED, NULL);
entry_->net_log().EndEvent(GetSparseEventType(operation_), NULL);
}
+ // We have an indirect reference to this object for every callback so if
+ // there is only one callback, we may delete this object before reaching
+ // DoAbortCallbacks.
+ bool has_abort_callbacks = !abort_callbacks_.empty();
DoUserCallback();
- return DoAbortCallbacks();
+ if (has_abort_callbacks)
+ DoAbortCallbacks();
+ return;
}
// We are running a callback from the message loop. It's time to restart what