Bug 566057: Remove obsolete managee tracking code in ContentProcessChild that's leading to use-after-free errors. r=jduell

This commit is contained in:
Chris Jones 2010-05-15 00:27:52 -05:00
Родитель ca8676612f
Коммит 37a15f9f78
2 изменённых файлов: 5 добавлений и 34 удалений

Просмотреть файл

@ -61,7 +61,6 @@ namespace dom {
ContentProcessChild* ContentProcessChild::sSingleton; ContentProcessChild* ContentProcessChild::sSingleton;
ContentProcessChild::ContentProcessChild() ContentProcessChild::ContentProcessChild()
: mQuit(PR_FALSE)
{ {
} }
@ -86,37 +85,27 @@ PIFrameEmbeddingChild*
ContentProcessChild::AllocPIFrameEmbedding() ContentProcessChild::AllocPIFrameEmbedding()
{ {
nsRefPtr<TabChild> iframe = new TabChild(); nsRefPtr<TabChild> iframe = new TabChild();
NS_ENSURE_TRUE(iframe && NS_SUCCEEDED(iframe->Init()) && return NS_SUCCEEDED(iframe->Init()) ? iframe.forget().get() : NULL;
mIFrames.AppendElement(iframe),
nsnull);
return iframe.forget().get();
} }
bool bool
ContentProcessChild::DeallocPIFrameEmbedding(PIFrameEmbeddingChild* iframe) ContentProcessChild::DeallocPIFrameEmbedding(PIFrameEmbeddingChild* iframe)
{ {
if (mIFrames.RemoveElement(iframe)) { TabChild* child = static_cast<TabChild*>(iframe);
TabChild* child = static_cast<TabChild*>(iframe); NS_RELEASE(child);
NS_RELEASE(child);
}
return true; return true;
} }
PTestShellChild* PTestShellChild*
ContentProcessChild::AllocPTestShell() ContentProcessChild::AllocPTestShell()
{ {
PTestShellChild* testshell = new TestShellChild(); return new TestShellChild();
if (testshell && mTestShells.AppendElement(testshell)) {
return testshell;
}
delete testshell;
return nsnull;
} }
bool bool
ContentProcessChild::DeallocPTestShell(PTestShellChild* shell) ContentProcessChild::DeallocPTestShell(PTestShellChild* shell)
{ {
mTestShells.RemoveElement(shell); delete shell;
return true; return true;
} }
@ -163,23 +152,12 @@ ContentProcessChild::RecvSetOffline(const PRBool& offline)
return true; return true;
} }
void
ContentProcessChild::Quit()
{
NS_ASSERTION(mQuit, "Exiting uncleanly!");
mIFrames.Clear();
mTestShells.Clear();
}
void void
ContentProcessChild::ActorDestroy(ActorDestroyReason why) ContentProcessChild::ActorDestroy(ActorDestroyReason why)
{ {
if (AbnormalShutdown == why) if (AbnormalShutdown == why)
NS_WARNING("shutting down because of crash!"); NS_WARNING("shutting down because of crash!");
mQuit = PR_TRUE;
Quit();
XRE_ShutdownChildProcess(); XRE_ShutdownChildProcess();
} }

Просмотреть файл

@ -89,15 +89,8 @@ private:
NS_OVERRIDE NS_OVERRIDE
virtual void ActorDestroy(ActorDestroyReason why); virtual void ActorDestroy(ActorDestroyReason why);
void Quit();
static ContentProcessChild* sSingleton; static ContentProcessChild* sSingleton;
nsTArray<PIFrameEmbeddingChild* > mIFrames;
nsTArray<nsAutoPtr<PTestShellChild> > mTestShells;
PRBool mQuit;
DISALLOW_EVIL_CONSTRUCTORS(ContentProcessChild); DISALLOW_EVIL_CONSTRUCTORS(ContentProcessChild);
}; };