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

Side by Side Diff: chrome_frame/urlmon_url_request.cc

Issue 3159045: Fix a crash when delegate_ goes away in ReadStream... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome_frame/urlmon_url_request.h" 5 #include "chrome_frame/urlmon_url_request.h"
6 6
7 #include <wininet.h> 7 #include <wininet.h>
8 #include <urlmon.h> 8 #include <urlmon.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 // response end notification to chrome. 214 // response end notification to chrome.
215 if (hr == S_FALSE) 215 if (hr == S_FALSE)
216 pending_data_.Release(); 216 pending_data_.Release();
217 } 217 }
218 218
219 bytes_copied = read_data.length(); 219 bytes_copied = read_data.length();
220 220
221 if (bytes_copied) { 221 if (bytes_copied) {
222 ++calling_delegate_; 222 ++calling_delegate_;
223 DCHECK_NE(id(), -1); 223 DCHECK_NE(id(), -1);
224 delegate_->OnReadComplete(id(), read_data); 224 // The delegate can go away in the middle of ReadStream
225 if (delegate_)
226 delegate_->OnReadComplete(id(), read_data);
225 --calling_delegate_; 227 --calling_delegate_;
226 } 228 }
227 } else { 229 } else {
228 DLOG(ERROR) << __FUNCTION__ << me() << "no delegate"; 230 DLOG(ERROR) << __FUNCTION__ << me() << "no delegate";
229 } 231 }
230 232
231 return bytes_copied; 233 return bytes_copied;
232 } 234 }
233 235
234 STDMETHODIMP UrlmonUrlRequest::OnStartBinding(DWORD reserved, 236 STDMETHODIMP UrlmonUrlRequest::OnStartBinding(DWORD reserved,
(...skipping 926 matching lines...) Expand 10 before | Expand all | Expand 10 after
1161 privacy_info_.privacy_records[UTF8ToWide(url)]; 1163 privacy_info_.privacy_records[UTF8ToWide(url)];
1162 1164
1163 privacy_entry.flags |= flags; 1165 privacy_entry.flags |= flags;
1164 privacy_entry.policy_ref = UTF8ToWide(policy_ref); 1166 privacy_entry.policy_ref = UTF8ToWide(policy_ref);
1165 1167
1166 if (fire_privacy_event && IsWindow(notification_window_)) { 1168 if (fire_privacy_event && IsWindow(notification_window_)) {
1167 PostMessage(notification_window_, WM_FIRE_PRIVACY_CHANGE_NOTIFICATION, 1, 1169 PostMessage(notification_window_, WM_FIRE_PRIVACY_CHANGE_NOTIFICATION, 1,
1168 0); 1170 0);
1169 } 1171 }
1170 } 1172 }
OLDNEW
« 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