Make sure to null out the weak parent ptr in session history entries as
needed. Bug 305181, r=bryner, sr=jst git-svn-id: svn://10.0.0.236/trunk@179451 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -99,8 +99,20 @@ nsSHEntry::nsSHEntry(const nsSHEntry &other)
|
||||
{
|
||||
}
|
||||
|
||||
PR_STATIC_CALLBACK(PRBool)
|
||||
ClearParentPtr(nsISHEntry* aEntry, void* /* aData */)
|
||||
{
|
||||
if (aEntry) {
|
||||
aEntry->SetParent(nsnull);
|
||||
}
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
nsSHEntry::~nsSHEntry()
|
||||
{
|
||||
// Since we never really remove kids from SHEntrys, we need to null
|
||||
// out the mParent pointers on all our kids.
|
||||
mChildren.EnumerateForwards(ClearParentPtr, nsnull);
|
||||
mChildren.Clear();
|
||||
RemoveDocumentObserver();
|
||||
if (mContentViewer)
|
||||
@@ -469,6 +481,15 @@ nsSHEntry::AddChild(nsISHEntry * aChild, PRInt32 aOffset)
|
||||
//
|
||||
NS_ASSERTION(aOffset < (mChildren.Count()+1023), "Large frames array!\n");
|
||||
|
||||
if (aOffset < mChildren.Count()) {
|
||||
nsISHEntry* oldChild = mChildren.ObjectAt(aOffset);
|
||||
if (oldChild && oldChild != aChild) {
|
||||
NS_ERROR("Adding child where we already have a child? "
|
||||
"This will likely misbehave");
|
||||
oldChild->SetParent(nsnull);
|
||||
}
|
||||
}
|
||||
|
||||
// This implicitly extends the array to include aOffset
|
||||
mChildren.ReplaceObjectAt(aChild, aOffset);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user