Bug 1266882 - Ensure the return value of CreateBR is addrefed in CopyLastEditableChildStyles. r=masayuki a=lizzard
authorAndrew McCreight <continuation@gmail.com>
Fri, 08 Jul 2016 15:37:42 -0700
changeset 335588 8e54a7dccda8dfa6d61f45d4804de5c95a205fb7
parent 335587 9fa604a17de720cc70a2dcfb966f4e660d3bfe3f
child 335589 ebd3919e8a3a0c4bcc5c3933ab693b44b38f490e
push id1146
push userCallek@gmail.com
push dateMon, 25 Jul 2016 16:35:44 +0000
treeherdermozilla-release@a55778f9cd5a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmasayuki, lizzard
bugs1266882
milestone48.0
Bug 1266882 - Ensure the return value of CreateBR is addrefed in CopyLastEditableChildStyles. r=masayuki a=lizzard
editor/libeditor/nsHTMLEditor.cpp
--- a/editor/libeditor/nsHTMLEditor.cpp
+++ b/editor/libeditor/nsHTMLEditor.cpp
@@ -4768,17 +4768,18 @@ nsHTMLEditor::CopyLastEditableChildStyle
           CreateNode(childElement->NodeInfo()->NameAtom(), newBlock, 0);
         NS_ENSURE_STATE(newStyles);
       }
       CloneAttributes(newStyles, childElement);
     }
     childElement = childElement->GetParentElement();
   }
   if (deepestStyle) {
-    *aOutBrNode = GetAsDOMNode(CreateBR(deepestStyle, 0));
+    nsCOMPtr<nsIDOMNode> retVal = GetAsDOMNode(CreateBR(deepestStyle, 0));
+    retVal.forget(aOutBrNode);
     NS_ENSURE_STATE(*aOutBrNode);
   }
   return NS_OK;
 }
 
 nsresult
 nsHTMLEditor::GetElementOrigin(nsIDOMElement * aElement, int32_t & aX, int32_t & aY)
 {