Closed
Bug 579830
Opened 14 years ago
Closed 14 years ago
Convert nsCOMPtr<mozilla::dom::Element> to use nsRefPtr
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
People
(Reporter: craig.topper, Assigned: craig.topper)
Details
Attachments
(2 files, 1 obsolete file)
800 bytes,
patch
|
benjamin
:
review-
|
Details | Diff | Splinter Review |
7.38 KB,
patch
|
bzbarsky
:
review+
benjamin
:
approval2.0+
|
Details | Diff | Splinter Review |
mozilla::dom::Element isn't an interface and doesn't have an IID so shouldn't be using nsCOMPtr. Most cases its just for reference counting so nsRefPtr will work equally well. One location does do a QI into one of these nsCOMPtr<Element> which actually QIs to nsIContent(due to it being the nearest base class with an IID) and gets typecast to an Element. While it currently works this could break in the future. In this particular case we should QI to nsINode and then call AsElement(). I have added private unimplemented copies of GetIID and kID to catch recreations of the above behavior. Also found one instance of an nsCOMPtr<nsGenericHTMLElement> which I converted too.
Attachment #458266 -
Flags: review?(bzbarsky)
Comment 1•14 years ago
|
||
Comment on attachment 458266 [details] [diff] [review] Patch > +++ b/content/html/content/src/nsGenericHTMLElement.cpp Huh. I'd think that nsGenericHTMLElementTearoff needs a nonempty traverse (and maybe unlink?) implementation. Please file a followup on that, cc peterv, request blocking2.0. The rest looks fine to me, but I'd like Benjamin to look at the iid stuff.
Attachment #458266 -
Flags: review?(bzbarsky)
Attachment #458266 -
Flags: review?(benjamin)
Attachment #458266 -
Flags: review+
Assignee | ||
Comment 2•14 years ago
|
||
nsGenericHTMLElementTearoff has a proper Traverse/Unlink implemented like so: NS_IMPL_CYCLE_COLLECTION_1(nsGenericHTMLElementTearoff, mElement)
Assignee | ||
Comment 3•14 years ago
|
||
Original patch doesn't apply anymore. Went ahead and separated out this part from the rest.
Attachment #458266 -
Attachment is obsolete: true
Attachment #460184 -
Flags: review?(benjamin)
Attachment #458266 -
Flags: review?(benjamin)
Assignee | ||
Comment 4•14 years ago
|
||
Assignee | ||
Updated•14 years ago
|
Attachment #460185 -
Flags: review?(bzbarsky)
Comment 5•14 years ago
|
||
Comment on attachment 460185 [details] [diff] [review] Change all the nsCOMPtrs to nsRefPtr and fix the bad QI. r=bzbarsky
Attachment #460185 -
Flags: review?(bzbarsky) → review+
Assignee | ||
Updated•14 years ago
|
Attachment #460185 -
Flags: approval2.0?
Updated•14 years ago
|
Attachment #460185 -
Flags: approval2.0? → approval2.0+
Comment 6•14 years ago
|
||
http://hg.mozilla.org/mozilla-central/rev/99146dea1c85
Comment 7•14 years ago
|
||
Comment on attachment 460184 [details] [diff] [review] Give Element a private IID to catch problems like this in the future I would rather not take this patch, actually, in favor of the solution in bug 514280. There are a few details to fix in that bug.
Attachment #460184 -
Flags: review?(benjamin) → review-
Assignee | ||
Comment 8•14 years ago
|
||
(In reply to comment #7) > Comment on attachment 460184 [details] [diff] [review] > Give Element a private IID to catch problems like this in the future > > I would rather not take this patch, actually, in favor of the solution in bug > 514280. There are a few details to fix in that bug. Given that I will close this bug then. I'll hang on to the private IID patch in my queue and file bugs if anything creeps back in until the other bug is checked in.
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•