Bug 1125030 - Handle VsyncChild shutdown in ActorDestroy(). r=bent

This commit is contained in:
JerryShih
2015-01-29 22:19:00 +01:00
parent 01d4c273bc
commit 00c6a1afac
4 changed files with 25 additions and 8 deletions

View File

@@ -190,7 +190,10 @@ BackgroundChildImpl::DeallocPFileDescriptorSetChild(
BackgroundChildImpl::PVsyncChild*
BackgroundChildImpl::AllocPVsyncChild()
{
return new mozilla::layout::VsyncChild();
nsRefPtr<mozilla::layout::VsyncChild> actor = new mozilla::layout::VsyncChild();
// There still has one ref-count after return, and it will be released in
// DeallocPVsyncChild().
return actor.forget().take();
}
bool
@@ -198,7 +201,9 @@ BackgroundChildImpl::DeallocPVsyncChild(PVsyncChild* aActor)
{
MOZ_ASSERT(aActor);
delete static_cast<mozilla::layout::VsyncChild*>(aActor);
// This actor already has one ref-count. Please check AllocPVsyncChild().
nsRefPtr<mozilla::layout::VsyncChild> actor =
dont_AddRef(static_cast<mozilla::layout::VsyncChild*>(aActor));
return true;
}