Bug 1048011 - Fix a race condition that causes PProcLoaderParent leak. r=khuey

--HG--
extra : rebase_source : d0230771da1992fab13681c9b5baa585d334d0cc
This commit is contained in:
Cervantes Yu 2014-08-11 15:50:20 +08:00
parent 5bba7ad647
commit fbb99791d2

View File

@ -122,12 +122,22 @@ public:
void
ProcLoaderParent::ActorDestroy(ActorDestroyReason aWhy)
{
if (aWhy == AbnormalShutdown) {
NS_WARNING("ProcLoaderParent is destroyed abnormally.");
}
if (sProcLoaderClientOnDeinit) {
// Get error for closing while the channel is already error.
return;
}
// Destroy self asynchronously.
ProcLoaderClientDeinit();
}
static void
_ProcLoaderParentDestroy(PProcLoaderParent *aLoader)
{
aLoader->Close();
delete aLoader;
sProcLoaderClientOnDeinit = false;
}
@ -136,7 +146,6 @@ bool
ProcLoaderParent::RecvLoadComplete(const int32_t &aPid,
const int32_t &aCookie)
{
ProcLoaderClientDeinit();
return true;
}