зеркало из https://github.com/mozilla/gecko-dev.git
Changed Destroy() to release references to and destroy its child
web shells. This fixes it so we don't leak all of the web shells for frameset documents
This commit is contained in:
Родитель
af6e254303
Коммит
0c7fbc0e79
|
@ -311,6 +311,7 @@ protected:
|
|||
nsVoidArray mRefreshments;
|
||||
|
||||
void ReleaseChildren();
|
||||
void DestroyChildren();
|
||||
|
||||
static nsIPluginHost *mPluginHost;
|
||||
static nsIPluginManager *mPluginManager;
|
||||
|
@ -442,8 +443,12 @@ nsWebShell::~nsWebShell()
|
|||
}
|
||||
NS_IF_RELEASE(mScriptContext);
|
||||
|
||||
// XXX Because we hold references to the children and they hold references
|
||||
// to us we never get destroyed. See Destroy() instead...
|
||||
#if 0
|
||||
// Release references on our children
|
||||
ReleaseChildren();
|
||||
#endif
|
||||
|
||||
// Free up history memory
|
||||
PRInt32 i, n = mHistory.Count();
|
||||
|
@ -470,6 +475,19 @@ nsWebShell::ReleaseChildren()
|
|||
mChildren.Clear();
|
||||
}
|
||||
|
||||
void
|
||||
nsWebShell::DestroyChildren()
|
||||
{
|
||||
PRInt32 i, n = mChildren.Count();
|
||||
for (i = 0; i < n; i++) {
|
||||
nsIWebShell* shell = (nsIWebShell*) mChildren.ElementAt(i);
|
||||
shell->SetParent(nsnull);
|
||||
shell->Destroy();
|
||||
NS_RELEASE(shell);
|
||||
}
|
||||
mChildren.Clear();
|
||||
}
|
||||
|
||||
NS_IMPL_THREADSAFE_ADDREF(nsWebShell)
|
||||
NS_IMPL_THREADSAFE_RELEASE(nsWebShell)
|
||||
|
||||
|
@ -704,6 +722,8 @@ nsWebShell::Destroy()
|
|||
|
||||
NS_IF_RELEASE(mContentViewer);
|
||||
|
||||
// Destroy our child web shells and release references to them
|
||||
DestroyChildren();
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -311,6 +311,7 @@ protected:
|
|||
nsVoidArray mRefreshments;
|
||||
|
||||
void ReleaseChildren();
|
||||
void DestroyChildren();
|
||||
|
||||
static nsIPluginHost *mPluginHost;
|
||||
static nsIPluginManager *mPluginManager;
|
||||
|
@ -442,8 +443,12 @@ nsWebShell::~nsWebShell()
|
|||
}
|
||||
NS_IF_RELEASE(mScriptContext);
|
||||
|
||||
// XXX Because we hold references to the children and they hold references
|
||||
// to us we never get destroyed. See Destroy() instead...
|
||||
#if 0
|
||||
// Release references on our children
|
||||
ReleaseChildren();
|
||||
#endif
|
||||
|
||||
// Free up history memory
|
||||
PRInt32 i, n = mHistory.Count();
|
||||
|
@ -470,6 +475,19 @@ nsWebShell::ReleaseChildren()
|
|||
mChildren.Clear();
|
||||
}
|
||||
|
||||
void
|
||||
nsWebShell::DestroyChildren()
|
||||
{
|
||||
PRInt32 i, n = mChildren.Count();
|
||||
for (i = 0; i < n; i++) {
|
||||
nsIWebShell* shell = (nsIWebShell*) mChildren.ElementAt(i);
|
||||
shell->SetParent(nsnull);
|
||||
shell->Destroy();
|
||||
NS_RELEASE(shell);
|
||||
}
|
||||
mChildren.Clear();
|
||||
}
|
||||
|
||||
NS_IMPL_THREADSAFE_ADDREF(nsWebShell)
|
||||
NS_IMPL_THREADSAFE_RELEASE(nsWebShell)
|
||||
|
||||
|
@ -704,6 +722,8 @@ nsWebShell::Destroy()
|
|||
|
||||
NS_IF_RELEASE(mContentViewer);
|
||||
|
||||
// Destroy our child web shells and release references to them
|
||||
DestroyChildren();
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче