From 6ef2ae37f07d3a5517be145caf154b14612af7ad Mon Sep 17 00:00:00 2001 From: "dbaron%fas.harvard.edu" Date: Sun, 3 Mar 2002 00:02:00 +0000 Subject: [PATCH] Fix typo in nsRuleNode::ClearCachedDataInSubtree so it only clears data associated with |aRule|. This fixes a crash since nsStyleContext::ClearStyleData didn't make the same mistake and clean up dangling pointers to the incorrectly deleted data. b=105619 r=bzbarsky sr=brendan a=shaver git-svn-id: svn://10.0.0.236/trunk@115660 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/base/src/nsRuleNode.cpp | 5 +++-- mozilla/layout/style/nsRuleNode.cpp | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/mozilla/content/base/src/nsRuleNode.cpp b/mozilla/content/base/src/nsRuleNode.cpp index 39af1f40fa4..d632038bbcd 100644 --- a/mozilla/content/base/src/nsRuleNode.cpp +++ b/mozilla/content/base/src/nsRuleNode.cpp @@ -526,6 +526,7 @@ nsRuleNode::ClearCachedData(nsIStyleRule* aRule) // of inline style, all nodes along this path must have exactly one child. This // is not a bushy subtree, and so we know that by clearing this path, we've // invalidated everything that we need to. + // XXXldb What about !important :hover rules, and such? nsRuleNode* curr = this; while (curr) { curr->mNoneBits &= ~NS_STYLE_INHERIT_MASK; @@ -560,7 +561,7 @@ nsRuleNode::ClearCachedDataInSubtree(nsIStyleRule* aRule) mStyleData.Destroy(0, mPresContext); mNoneBits &= ~NS_STYLE_INHERIT_MASK; mDependentBits &= ~NS_STYLE_INHERIT_MASK; - aRule = nsnull; + aRule = nsnull; // Cause everything to be blown away in the descendants. } if (!mParent) { @@ -569,7 +570,7 @@ nsRuleNode::ClearCachedDataInSubtree(nsIStyleRule* aRule) } else for (nsRuleList* curr = mChildren; curr; curr = curr->mNext) - curr->mRuleNode->ClearCachedDataInSubtree(curr->mRuleNode->mRule); + curr->mRuleNode->ClearCachedDataInSubtree(aRule); return NS_OK; } diff --git a/mozilla/layout/style/nsRuleNode.cpp b/mozilla/layout/style/nsRuleNode.cpp index 39af1f40fa4..d632038bbcd 100644 --- a/mozilla/layout/style/nsRuleNode.cpp +++ b/mozilla/layout/style/nsRuleNode.cpp @@ -526,6 +526,7 @@ nsRuleNode::ClearCachedData(nsIStyleRule* aRule) // of inline style, all nodes along this path must have exactly one child. This // is not a bushy subtree, and so we know that by clearing this path, we've // invalidated everything that we need to. + // XXXldb What about !important :hover rules, and such? nsRuleNode* curr = this; while (curr) { curr->mNoneBits &= ~NS_STYLE_INHERIT_MASK; @@ -560,7 +561,7 @@ nsRuleNode::ClearCachedDataInSubtree(nsIStyleRule* aRule) mStyleData.Destroy(0, mPresContext); mNoneBits &= ~NS_STYLE_INHERIT_MASK; mDependentBits &= ~NS_STYLE_INHERIT_MASK; - aRule = nsnull; + aRule = nsnull; // Cause everything to be blown away in the descendants. } if (!mParent) { @@ -569,7 +570,7 @@ nsRuleNode::ClearCachedDataInSubtree(nsIStyleRule* aRule) } else for (nsRuleList* curr = mChildren; curr; curr = curr->mNext) - curr->mRuleNode->ClearCachedDataInSubtree(curr->mRuleNode->mRule); + curr->mRuleNode->ClearCachedDataInSubtree(aRule); return NS_OK; }