Bug 1447156; r=bkelly a=abillings
authorJan Varga <jan.varga@gmail.com>
Wed, 11 Apr 2018 06:36:04 +0200
changeset 412793 42be71805c4200a6507cf7e83342b89ede53ebb3
parent 412792 1c0b2e2a81d1f6628253979edac1a4f8c2326d6e
child 412794 fb6547e96546f8063935adb89ddff55c3f7f50e9
push id33818
push userapavel@mozilla.com
push dateWed, 11 Apr 2018 14:36:40 +0000
treeherdermozilla-central@cfe6399e142c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbkelly, abillings
bugs1447156
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1447156; r=bkelly a=abillings
ipc/glue/BackgroundImpl.cpp
--- a/ipc/glue/BackgroundImpl.cpp
+++ b/ipc/glue/BackgroundImpl.cpp
@@ -1419,16 +1419,17 @@ ChildImpl::Shutdown()
 
   if (threadLocalInfo) {
 #ifdef DEBUG
     MOZ_ASSERT(!threadLocalInfo->mClosed);
     threadLocalInfo->mClosed = true;
 #endif
 
     ThreadLocalDestructor(threadLocalInfo);
+    sMainThreadInfo = nullptr;
   }
 }
 
 ChildImpl::ThreadLocalInfo* ChildImpl::sMainThreadInfo = nullptr;
 
 // static
 PBackgroundChild*
 ChildImpl::GetForCurrentThread()
@@ -1448,16 +1449,20 @@ ChildImpl::GetForCurrentThread()
 
 /* static */
 PBackgroundChild*
 ChildImpl::GetOrCreateForCurrentThread()
 {
   MOZ_ASSERT(sThreadLocalIndex != kBadThreadLocalIndex,
              "BackgroundChild::Startup() was never called!");
 
+  if (NS_IsMainThread() && sShutdownHasStarted) {
+    return nullptr;
+  }
+
   auto threadLocalInfo = NS_IsMainThread() ? sMainThreadInfo :
     static_cast<ThreadLocalInfo*>(PR_GetThreadPrivate(sThreadLocalIndex));
 
   if (!threadLocalInfo) {
     nsAutoPtr<ThreadLocalInfo> newInfo(new ThreadLocalInfo());
 
     if (NS_IsMainThread()) {
       sMainThreadInfo = newInfo;