Closed Bug 686941 Opened 13 years ago Closed 13 years ago

Consider making nsIDocument::mCachedRootElement a weak pointer

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla10

People

(Reporter: khuey, Assigned: khuey)

Details

Attachments

(1 file)

      No description provided.
Version: unspecified → Trunk
Seems like that would allow us to make it an Element*.
Attached patch PatchSplinter Review
This makes us store an Element*, at the cost of moving the function into nsDocument.cpp.  If that's not acceptable I can go back to the nsIContent*.
Assignee: nobody → khuey
Status: NEW → ASSIGNED
Attachment #560776 - Flags: review?(Olli.Pettay)
Back to an nsINode of course.
Comment on attachment 560776 [details] [diff] [review]
Patch

>@@ -1918,17 +1917,16 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(ns
>   for (PRInt32 indx = PRInt32(tmp->mChildren.ChildCount()) - 1; 
>        indx >= 0; --indx) {
>     tmp->mChildren.ChildAt(indx)->UnbindFromTree();
>     tmp->mChildren.RemoveChildAt(indx);
>   }
>   tmp->mFirstChild = nsnull;
> 
>   NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mXPathEvaluatorTearoff)
>-  NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mCachedRootElement)
You must add tmp->mCachedRootElement = nsnull;
otherwise it may point to a deleted object after unlinking.
Attachment #560776 - Flags: review?(Olli.Pettay) → review+
https://hg.mozilla.org/mozilla-central/rev/d0dac9811895
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
Target Milestone: --- → mozilla10
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: