Last Comment Bug 686941 - Consider making nsIDocument::mCachedRootElement a weak pointer
: Consider making nsIDocument::mCachedRootElement a weak pointer
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: DOM: Core & HTML (show other bugs)
: Trunk
: All All
: -- normal (vote)
: mozilla10
Assigned To: Kyle Huey [:khuey] (khuey@mozilla.com)
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-09-15 13:34 PDT by Kyle Huey [:khuey] (khuey@mozilla.com)
Modified: 2011-09-29 09:13 PDT (History)
8 users (show)
khuey: in‑testsuite-
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Patch (4.56 KB, patch)
2011-09-18 05:04 PDT, Kyle Huey [:khuey] (khuey@mozilla.com)
bugs: review+
Details | Diff | Review

Description Kyle Huey [:khuey] (khuey@mozilla.com) 2011-09-15 13:34:35 PDT

    
Comment 1 :Ms2ger 2011-09-17 05:50:16 PDT
Seems like that would allow us to make it an Element*.
Comment 2 Kyle Huey [:khuey] (khuey@mozilla.com) 2011-09-18 05:04:55 PDT
Created attachment 560776 [details] [diff] [review]
Patch

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*.
Comment 3 Kyle Huey [:khuey] (khuey@mozilla.com) 2011-09-18 05:05:51 PDT
Back to an nsINode of course.
Comment 4 Olli Pettay [:smaug] 2011-09-20 00:44:26 PDT
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.
Comment 5 Kyle Huey [:khuey] (khuey@mozilla.com) 2011-09-29 09:13:25 PDT
https://hg.mozilla.org/mozilla-central/rev/d0dac9811895

Note You need to log in before you can comment on or make changes to this bug.