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

Side by Side Diff: content/browser/browser_child_process_host.cc

Issue 8776041: Fix use-after-free. OnChildDied deletes the current object, so we shouldn't call member functions... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 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 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "content/browser/browser_child_process_host.h" 5 #include "content/browser/browser_child_process_host.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 // The child process handle has been signaled so the exit code is finally 221 // The child process handle has been signaled so the exit code is finally
222 // available. Unfortunately STILL_ACTIVE (0x103) is a valid exit code in 222 // available. Unfortunately STILL_ACTIVE (0x103) is a valid exit code in
223 // which case we should not call OnChildDisconnected() or else we will be 223 // which case we should not call OnChildDisconnected() or else we will be
224 // waiting forever. 224 // waiting forever.
225 void BrowserChildProcessHost::OnWaitableEventSignaled( 225 void BrowserChildProcessHost::OnWaitableEventSignaled(
226 base::WaitableEvent* waitable_event) { 226 base::WaitableEvent* waitable_event) {
227 #if defined (OS_WIN) 227 #if defined (OS_WIN)
228 unsigned long exit_code = 0; 228 unsigned long exit_code = 0;
229 GetExitCodeProcess(waitable_event->Release(), &exit_code); 229 GetExitCodeProcess(waitable_event->Release(), &exit_code);
230 delete waitable_event; 230 delete waitable_event;
231 if (exit_code == STILL_ACTIVE) 231 if (exit_code == STILL_ACTIVE) {
232 OnChildDied(); 232 OnChildDied();
233 BrowserChildProcessHost::OnChildDisconnected(); 233 } else {
234 BrowserChildProcessHost::OnChildDisconnected();
235 }
234 #endif 236 #endif
235 } 237 }
236 238
237 void BrowserChildProcessHost::ShutdownStarted() { 239 void BrowserChildProcessHost::ShutdownStarted() {
238 // Must remove the process from the list now, in case it gets used for a 240 // Must remove the process from the list now, in case it gets used for a
239 // new instance before our watcher tells us that the process terminated. 241 // new instance before our watcher tells us that the process terminated.
240 g_child_process_list.Get().remove(this); 242 g_child_process_list.Get().remove(this);
241 } 243 }
242 244
243 BrowserChildProcessHost::ClientHook::ClientHook(BrowserChildProcessHost* host) 245 BrowserChildProcessHost::ClientHook::ClientHook(BrowserChildProcessHost* host)
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 282
281 return *iterator_; 283 return *iterator_;
282 } while (true); 284 } while (true);
283 285
284 return NULL; 286 return NULL;
285 } 287 }
286 288
287 bool BrowserChildProcessHost::Iterator::Done() { 289 bool BrowserChildProcessHost::Iterator::Done() {
288 return iterator_ == g_child_process_list.Get().end(); 290 return iterator_ == g_child_process_list.Get().end();
289 } 291 }
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