Fix leaks. r=dbaron, sr=hewitt

git-svn-id: svn://10.0.0.236/trunk@106127 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
hyatt%netscape.com 2001-10-24 02:22:40 +00:00
parent 34e3cda14f
commit 9d81f5d9f9

View File

@ -407,15 +407,28 @@ nsRuleNode::nsRuleNode(nsIPresContext* aContext, nsIStyleRule* aRule, nsRuleNode
mRootChildren = nsnull;
}
PR_STATIC_CALLBACK(PRBool) DeleteRuleNodeChildren(nsHashKey* aKey, void* aData, void* aClosure)
{
nsRuleNode* ruleNode = (nsRuleNode*)aData;
ruleNode->Destroy();
return PR_TRUE;
}
nsRuleNode::~nsRuleNode()
{
MOZ_COUNT_DTOR(nsRuleNode);
if (mStyleData.mResetData || mStyleData.mInheritedData)
mStyleData.Destroy(0, mPresContext);
if (mParent && mChildren)
mChildren->Destroy(mPresContext);
else if (!mParent)
delete mRootChildren;
if (mParent) {
if (mChildren)
mChildren->Destroy(mPresContext);
}
else {
if (mRootChildren) {
mRootChildren->Enumerate(DeleteRuleNodeChildren, nsnull);
delete mRootChildren;
}
}
}
nsresult