Bug 1202424 - Free shared memory when IPC system shuts down, not after. r=mrbkap

This commit is contained in:
Gian-Carlo Pascutto 2015-09-11 09:33:36 +02:00
parent 4d0fe31fbc
commit d49de0d545
2 changed files with 14 additions and 6 deletions

View File

@ -766,6 +766,18 @@ CamerasParent::RecvStopCapture(const int& aCapEngine,
return SendReplySuccess();
}
void
CamerasParent::StopIPC()
{
MOZ_ASSERT(!mDestroyed);
// Release shared memory now, it's our last chance
mShmemPool.Cleanup(this);
// We don't want to receive callbacks or anything if we can't
// forward them anymore anyway.
mChildIsAlive = false;
mDestroyed = true;
}
bool
CamerasParent::RecvAllDone()
{
@ -791,8 +803,6 @@ void CamerasParent::DoShutdown()
}
}
mShmemPool.Cleanup(this);
mPBackgroundThread = nullptr;
if (mVideoCaptureThread) {
@ -809,10 +819,7 @@ CamerasParent::ActorDestroy(ActorDestroyReason aWhy)
{
// No more IPC from here
LOG((__PRETTY_FUNCTION__));
// We don't want to receive callbacks or anything if we can't
// forward them anymore anyway.
mChildIsAlive = false;
mDestroyed = true;
StopIPC();
CloseEngines();
}

View File

@ -117,6 +117,7 @@ protected:
void CloseEngines();
bool EnsureInitialized(int aEngine);
void DoShutdown();
void StopIPC();
EngineHelper mEngines[CaptureEngine::MaxEngine];
nsTArray<CallbackHelper*> mCallbacks;