Index: content/child/child_process.cc |
diff --git a/content/child/child_process.cc b/content/child/child_process.cc |
index 2763ee03cffdb0b12d5934091b9c31f7bad6ff39..7c5b408e842e328c5f0b8c2edc1abe0beb91a41b 100644 |
--- a/content/child/child_process.cc |
+++ b/content/child/child_process.cc |
@@ -67,11 +67,15 @@ ChildProcess::~ChildProcess() { |
// notice shutdown before the render process begins waiting for them to exit. |
shutdown_event_.Signal(); |
- // Kill the main thread object before nulling child_process, since |
- // destruction code might depend on it. |
if (main_thread_) { // null in unittests. |
main_thread_->Shutdown(); |
- main_thread_.reset(); |
+ if (main_thread_->ShouldBeDestroyed()) { |
+ main_thread_.reset(); |
+ } else { |
+ // Leak the main_thread_. See a comment in |
+ // RenderThreadImpl::ShouldBeDestroyed. |
+ main_thread_.release(); |
+ } |
} |
g_lazy_tls.Pointer()->Set(NULL); |