Bug 1474007 - Null check to prevent crash when ipc::mscom::GetInitialInterceptorForIID fails after PublishTarget. r=aklotz, a=RyanVM
authorJames Teh <jteh@mozilla.com>
Mon, 09 Jul 2018 10:24:20 +1000
changeset 473816 ad93c4fae965
parent 473815 647313afaa4a
child 473817 88d84c16e254
push id1749
push userryanvm@gmail.com
push date2018-08-06 13:40 +0000
treeherdermozilla-release@b5d39c025741 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaklotz, RyanVM
bugs1474007
milestone61.0.2
Bug 1474007 - Null check to prevent crash when ipc::mscom::GetInitialInterceptorForIID fails after PublishTarget. r=aklotz, a=RyanVM PublishTarget calls Unlock on our LiveSetAutolock. It's possible for GetInitialInterceptorForIID to fail after this point. This will cause the failure cleanup code to run, which tries to call Unlock again. However, the previous call to Unlock set mLiveSet to null, and Unlock previously didn't handle this case. Now, unlock is a no-op (in release builds) if it's already been called. MozReview-Commit-ID: 15ffXR6nKqc
ipc/mscom/Interceptor.cpp
--- a/ipc/mscom/Interceptor.cpp
+++ b/ipc/mscom/Interceptor.cpp
@@ -99,18 +99,20 @@ public:
     if (mLiveSet) {
       mLiveSet->Unlock();
     }
   }
 
   void Unlock()
   {
     MOZ_ASSERT(mLiveSet);
-    mLiveSet->Unlock();
-    mLiveSet = nullptr;
+    if (mLiveSet) {
+      mLiveSet->Unlock();
+      mLiveSet = nullptr;
+    }
   }
 
   LiveSetAutoLock(const LiveSetAutoLock& aOther) = delete;
   LiveSetAutoLock(LiveSetAutoLock&& aOther) = delete;
   LiveSetAutoLock& operator=(const LiveSetAutoLock& aOther) = delete;
   LiveSetAutoLock& operator=(LiveSetAutoLock&& aOther) = delete;
 
 private: