Index: chrome/browser/renderer_host/render_process_host.cc |
=================================================================== |
--- chrome/browser/renderer_host/render_process_host.cc (revision 27822) |
+++ chrome/browser/renderer_host/render_process_host.cc (working copy) |
@@ -87,7 +87,9 @@ |
} |
RenderProcessHost::~RenderProcessHost() { |
- all_hosts.Remove(id()); |
+ // In unit tests, Release() might not have been called. |
+ if (all_hosts.Lookup(id())) |
+ all_hosts.Remove(id()); |
} |
void RenderProcessHost::Attach(IPC::Channel::Listener* listener, |
@@ -108,6 +110,10 @@ |
NotificationType::RENDERER_PROCESS_TERMINATED, |
Source<RenderProcessHost>(this), NotificationService::NoDetails()); |
MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
+ |
+ // Remove ourself from the list of renderer processes so that we can't be |
+ // reused in between now and when the Delete task runs. |
+ all_hosts.Remove(id()); |
} |
} |