Bug 1430297: Use AddRef() instead of NS_ADDREF (when keeping generated content alive in nsCSSFrameConstructor). r?mats draft
authorDaniel Holbert <dholbert@cs.stanford.edu>
Fri, 12 Jan 2018 15:33:01 -0800
changeset 719944 d0b42f15ed28a9386337dea846d3da569617db44
parent 719941 792b172327f28a7d90aa51c38c26dff23cc06032
child 745935 58b4cd9d07738cbcc0f7d8dff51e6dc74fc29333
push id95404
push userdholbert@mozilla.com
push dateFri, 12 Jan 2018 23:33:23 +0000
reviewersmats
bugs1430297
milestone59.0a1
Bug 1430297: Use AddRef() instead of NS_ADDREF (when keeping generated content alive in nsCSSFrameConstructor). r?mats MozReview-Commit-ID: ECz1SCYO4ia
layout/base/nsCSSFrameConstructor.cpp
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -6235,17 +6235,18 @@ nsCSSFrameConstructor::AddFrameConstruct
                              aSuppressWhiteSpaceOptimizations, aAnonChildren);
   }
   item->mIsText = isText;
   item->mIsGeneratedContent = isGeneratedContent;
   item->mIsAnonymousContentCreatorContent =
     aFlags & ITEM_IS_ANONYMOUSCONTENTCREATOR_CONTENT;
   if (isGeneratedContent) {
     // We need to keep this alive until the frame takes ownership.
-    NS_ADDREF(item->mContent);
+    // This corresponds to the Release in ConstructFramesFromItem.
+    item->mContent->AddRef();
   }
   item->mIsRootPopupgroup =
     aNameSpaceID == kNameSpaceID_XUL && aTag == nsGkAtoms::popupgroup &&
     aContent->IsRootOfNativeAnonymousSubtree();
   if (item->mIsRootPopupgroup) {
     aState.mHavePendingPopupgroup = true;
   }
   item->mIsPopup = isPopup;