bug 1502841 - follow-up to ensure reentering DataStorageSharedThread::Shutdown() doesn't cause problems r=jcj a=jcristau
authorDana Keeler <dkeeler@mozilla.com>
Fri, 16 Nov 2018 16:14:52 +0000
changeset 501415 140ce47ccf2bb401dfddc6776de3ff3bfdadcc92
parent 501414 ce690bc5055827ce9a768a24472ed270b21231c3
child 501416 63ec2966de2035d3799d156c94ef42fed7587bc1
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjcj, jcristau
bugs1502841
milestone64.0
bug 1502841 - follow-up to ensure reentering DataStorageSharedThread::Shutdown() doesn't cause problems r=jcj a=jcristau We shouldn't reenter DataStorageSharedThread::Shutdown(), but it may be possible. To guard against potentially attempting to shut down the shared thread more than once, we can check gDataStorageSharedThreadShutDown first. Differential Revision: https://phabricator.services.mozilla.com/D12050
security/manager/ssl/DataStorage.cpp
--- a/security/manager/ssl/DataStorage.cpp
+++ b/security/manager/ssl/DataStorage.cpp
@@ -105,17 +105,17 @@ DataStorageSharedThread::Initialize()
 }
 
 nsresult
 DataStorageSharedThread::Shutdown()
 {
   MOZ_ASSERT(XRE_IsParentProcess());
   StaticMutexAutoLock lock(sDataStorageSharedThreadMutex);
 
-  if (!gDataStorageSharedThread) {
+  if (!gDataStorageSharedThread || gDataStorageSharedThreadShutDown) {
     return NS_OK;
   }
 
   MOZ_ASSERT(gDataStorageSharedThread->mThread);
   if (!gDataStorageSharedThread->mThread) {
     return NS_ERROR_FAILURE;
   }