Clean up NS_NewSVGDocument()

RESOLVED FIXED in mozilla16

Status

()

Core
SVG
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: dholbert, Assigned: dholbert)

Tracking

Trunk
mozilla16
x86_64
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

5 years ago
decoder was just asking me about some unused-by-tests code in nsSVGDocument.cpp, and one of the lines for checking the result of "new" in  NS_NewSVGDocument().

I'm filing this bug on removing that and doing a bit of other fixup in that function (using a nsRefPtr rather than a manual ADDREF / RELEASE)
(Assignee)

Comment 1

5 years ago
Created attachment 638810 [details] [diff] [review]
fix

This matches the pattern that we use in NS_NewSVG##_elementName##Element(), with nsRefPtr etc.:
http://mxr.mozilla.org/mozilla-central/source/content/svg/content/src/nsSVGElement.h?mark=584-602#581

The only difference is that I removed the null-check after "new", since it's infallible.
Attachment #638810 - Flags: review?
(Assignee)

Updated

5 years ago
Attachment #638810 - Flags: review? → review?(longsonr)
Comment on attachment 638810 [details] [diff] [review]
fix

longsonr is on vacation for a few weeks, so taking review.
Attachment #638810 - Flags: review?(longsonr) → review+
(Assignee)

Comment 3

5 years ago
Thanks!
https://hg.mozilla.org/integration/mozilla-inbound/rev/db774ca70b42
Target Milestone: --- → mozilla16
Comment on attachment 638810 [details] [diff] [review]
fix

Review of attachment 638810 [details] [diff] [review]:
-----------------------------------------------------------------

::: content/svg/document/src/nsSVGDocument.cpp
@@ +112,4 @@
>      return rv;
>    }
>  
> +  *aInstancePtrResult = doc.forget().get();

Exactly what doc.forget(aInstancePtrResult) is for
(Assignee)

Comment 5

5 years ago
Ah, nice -- I thought there was something like that.  (FWIW, I was copypasting an existing pattern, for maximum foolproof-ness, as noted in comment 1.)

Probably worth doing an MXR search for "forget().get()" and replacing with forget().  Ms2ger, perhaps you'd be interested in filing and either fixing or mentoring? :)
https://hg.mozilla.org/mozilla-central/rev/db774ca70b42
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.