Bug 881822 - Don't double-refcount HTMLBodyElement::mContentStyleRule; r=bholley
authorMs2ger <ms2ger@gmail.com>
Wed, 12 Jun 2013 09:00:09 +0200
changeset 146206 0414d6d0f60d80d584ac7811d3e2ffccb447f0ec
parent 146205 b8d033f67ca35fadeac4250e2715686c79bdf139
child 146242 c5875145f618c31aed2acbdfca17598f4ae4f65e
push id2697
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 18:49:53 +0000
treeherdermozilla-beta@dfec938c7b63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbholley
bugs881822
milestone24.0a1
first release with
nightly linux32
0414d6d0f60d / 24.0a1 / 20130612031138 / files
nightly linux64
0414d6d0f60d / 24.0a1 / 20130612031138 / files
nightly mac
0414d6d0f60d / 24.0a1 / 20130612031138 / files
nightly win32
0414d6d0f60d / 24.0a1 / 20130612031138 / files
nightly win64
0414d6d0f60d / 24.0a1 / 20130612031138 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 881822 - Don't double-refcount HTMLBodyElement::mContentStyleRule; r=bholley
content/html/content/src/HTMLBodyElement.cpp
--- a/content/html/content/src/HTMLBodyElement.cpp
+++ b/content/html/content/src/HTMLBodyElement.cpp
@@ -25,18 +25,18 @@
 NS_IMPL_NS_NEW_HTML_ELEMENT(Body)
 
 namespace mozilla {
 namespace dom {
 
 //----------------------------------------------------------------------
 
 BodyRule::BodyRule(HTMLBodyElement* aPart)
+  : mPart(aPart)
 {
-  mPart = aPart;
 }
 
 BodyRule::~BodyRule()
 {
 }
 
 NS_IMPL_ISUPPORTS1(BodyRule, nsIStyleRule)
 
@@ -344,19 +344,17 @@ HTMLBodyElement::ParseAttribute(int32_t 
                                               aResult);
 }
 
 void
 HTMLBodyElement::UnbindFromTree(bool aDeep, bool aNullParent)
 {
   if (mContentStyleRule) {
     mContentStyleRule->mPart = nullptr;
-
-    // destroy old style rule
-    NS_RELEASE(mContentStyleRule);
+    mContentStyleRule = nullptr;
   }
 
   nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);  
 }
 
 static 
 void MapAttributesIntoRule(const nsMappedAttributes* aAttributes, nsRuleData* aData)
 {
@@ -415,17 +413,16 @@ NS_IMETHODIMP
 HTMLBodyElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
 {
   nsGenericHTMLElement::WalkContentStyleRules(aRuleWalker);
 
   if (!mContentStyleRule && IsInDoc()) {
     // XXXbz should this use OwnerDoc() or GetCurrentDoc()?
     // sXBL/XBL2 issue!
     mContentStyleRule = new BodyRule(this);
-    NS_IF_ADDREF(mContentStyleRule);
   }
   if (aRuleWalker && mContentStyleRule) {
     aRuleWalker->Forward(mContentStyleRule);
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP_(bool)