Bug 1447156; r=bkelly a=ritu
authorJan Varga <jan.varga@gmail.com>
Wed, 11 Apr 2018 06:36:04 +0200
changeset 463570 53dd00cd3ae4f5201ca5bf71bf5f0174a0d84966
parent 463569 fbf11aa9e6b03970a555ef41fe6d1251113cf5db
child 463571 9bb4207e5c141b5febdfbc042727651e93078661
push id1690
push userryanvm@gmail.com
push dateFri, 27 Apr 2018 07:05:16 +0000
treeherdermozilla-release@b5cde4c8b05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbkelly, ritu
bugs1447156
milestone60.0
Bug 1447156; r=bkelly a=ritu
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;