Bug 1474007: Null check to prevent crash when ipc::mscom::GetInitialInterceptorForIID fails after PublishTarget. r?aklotz
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
--- 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: