Bug 1339852 - Fix a content canvas crash caused by losing IPC during a GPU process restart. r=mattwoodrow, a=lizzard
--- a/gfx/layers/client/TextureClient.cpp
+++ b/gfx/layers/client/TextureClient.cpp
@@ -1580,20 +1580,20 @@ int32_t
ShmemTextureReadLock::ReadUnlock() {
if (!mAllocSuccess) {
return 0;
}
ShmReadLockInfo* info = GetShmReadLockInfoPtr();
int32_t readCount = PR_ATOMIC_DECREMENT(&info->readCount);
MOZ_ASSERT(readCount >= 0);
if (readCount <= 0) {
- if (mClientAllocator) {
+ if (mClientAllocator && mClientAllocator->GetTileLockAllocator()) {
mClientAllocator->GetTileLockAllocator()->DeallocShmemSection(mShmemSection);
} else {
- // we are on the compositor process
+ // we are on the compositor process, or IPC is down.
FixedSizeSmallShmemSectionAllocator::FreeShmemSection(mShmemSection);
}
}
return readCount;
}
int32_t
ShmemTextureReadLock::GetReadCount() {
--- a/gfx/layers/ipc/CompositorBridgeChild.cpp
+++ b/gfx/layers/ipc/CompositorBridgeChild.cpp
@@ -1023,17 +1023,16 @@ CompositorBridgeChild::ClearTexturePool(
for (size_t i = 0; i < mTexturePools.Length(); i++) {
mTexturePools[i]->Clear();
}
}
FixedSizeSmallShmemSectionAllocator*
CompositorBridgeChild::GetTileLockAllocator()
{
- MOZ_ASSERT(IPCOpen());
if (!IPCOpen()) {
return nullptr;
}
if (!mSectionAllocator) {
mSectionAllocator = new FixedSizeSmallShmemSectionAllocator(this);
}
return mSectionAllocator;