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

Unified Diff: components/copresence/rpc/rpc_handler.cc

Issue 468213002: Fixing HttpPost deletion crash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 months 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/copresence/rpc/rpc_handler.cc
diff --git a/components/copresence/rpc/rpc_handler.cc b/components/copresence/rpc/rpc_handler.cc
index 7d89e9d310d0edbd608cffab68356d3093bafda1..f9a409716bef31be079ac9b93b2a7a258791b909 100644
--- a/components/copresence/rpc/rpc_handler.cc
+++ b/components/copresence/rpc/rpc_handler.cc
@@ -318,7 +318,8 @@ void RpcHandler::RegisterResponseHandler(
int http_status_code,
const std::string& response_data) {
if (completed_post) {
- DCHECK(pending_posts_.erase(completed_post));
+ int elements_erased = pending_posts_.erase(completed_post);
+ DCHECK(elements_erased);
rkc 2014/08/13 15:41:51 This will probably throw an unused variable compil
Charlie 2014/08/13 15:48:27 Nope, I've used this pattern before. There's even
delete completed_post;
}
@@ -347,7 +348,8 @@ void RpcHandler::ReportResponseHandler(const StatusCallback& status_callback,
int http_status_code,
const std::string& response_data) {
if (completed_post) {
- DCHECK(pending_posts_.erase(completed_post));
+ int elements_erased = pending_posts_.erase(completed_post);
+ DCHECK(elements_erased);
delete completed_post;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698