зеркало из https://github.com/mozilla/gecko-dev.git
Fixing bug 118194. Make sure we don't leave dangling document pointers in the content tree when the document goes away. r=bzbarsky@mit.edu, sr=vidur@netscape.com
This commit is contained in:
Родитель
882cccf833
Коммит
806d729272
|
@ -508,6 +508,28 @@ nsDocument::~nsDocument()
|
||||||
NS_RELEASE(subdoc);
|
NS_RELEASE(subdoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mRootContent) {
|
||||||
|
nsCOMPtr<nsIDocument> doc;
|
||||||
|
|
||||||
|
mRootContent->GetDocument(*getter_AddRefs(doc));
|
||||||
|
|
||||||
|
if (doc) {
|
||||||
|
// The root content still has a pointer back to the document,
|
||||||
|
// clear the document pointer in all children.
|
||||||
|
|
||||||
|
PRUint32 count;
|
||||||
|
mChildren->Count(&count);
|
||||||
|
for (indx = 0; (PRUint32)indx < count; indx++) {
|
||||||
|
nsCOMPtr<nsIContent> content;
|
||||||
|
|
||||||
|
mChildren->QueryElementAt(indx, NS_GET_IID(nsIContent),
|
||||||
|
getter_AddRefs(content));
|
||||||
|
|
||||||
|
content->SetDocument(nsnull, PR_TRUE, PR_FALSE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mRootContent = nsnull;
|
mRootContent = nsnull;
|
||||||
mChildren->Clear();
|
mChildren->Clear();
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче