diff --git a/gfx/layers/ipc/ImageBridgeChild.cpp b/gfx/layers/ipc/ImageBridgeChild.cpp index 2627a949e245..6cd9dbd84461 100644 --- a/gfx/layers/ipc/ImageBridgeChild.cpp +++ b/gfx/layers/ipc/ImageBridgeChild.cpp @@ -343,10 +343,11 @@ ImageBridgeChild::NotifyNotUsedToNonRecycle(uint64_t aTextureId, uint64_t aTrans mTexturesWaitingFenceHandle.Remove(aTextureId); // Release TextureClient on allocator's message loop. - TextureClientReleaseTask* task = new TextureClientReleaseTask(client); + RefPtr task = + MakeAndAddRef(client); RefPtr allocator = client->GetAllocator(); client = nullptr; - allocator->AsClientAllocator()->GetMessageLoop()->PostTask(FROM_HERE, task); + allocator->AsClientAllocator()->GetMessageLoop()->PostTask(task.forget()); #else NS_RUNTIMEABORT("not reached"); #endif