Last Comment Bug 770598 - Clean up NS_NewSVGDocument()
: Clean up NS_NewSVGDocument()
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: SVG (show other bugs)
: Trunk
: x86_64 Linux
: -- normal (vote)
: mozilla16
Assigned To: Daniel Holbert [:dholbert] (largely AFK until June 28)
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-07-03 10:53 PDT by Daniel Holbert [:dholbert] (largely AFK until June 28)
Modified: 2012-07-07 12:03 PDT (History)
2 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
fix (889 bytes, patch)
2012-07-03 11:21 PDT, Daniel Holbert [:dholbert] (largely AFK until June 28)
jwatt: review+
Details | Diff | Review

Description Daniel Holbert [:dholbert] (largely AFK until June 28) 2012-07-03 10:53:39 PDT
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)
Comment 1 Daniel Holbert [:dholbert] (largely AFK until June 28) 2012-07-03 11:21:51 PDT
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.
Comment 2 Jonathan Watt [:jwatt] (Away Jun. 27 - Jul. 13) 2012-07-05 03:06:16 PDT
Comment on attachment 638810 [details] [diff] [review]
fix

longsonr is on vacation for a few weeks, so taking review.
Comment 3 Daniel Holbert [:dholbert] (largely AFK until June 28) 2012-07-06 10:51:23 PDT
Thanks!
https://hg.mozilla.org/integration/mozilla-inbound/rev/db774ca70b42
Comment 4 :Ms2ger 2012-07-06 14:15:40 PDT
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
Comment 5 Daniel Holbert [:dholbert] (largely AFK until June 28) 2012-07-06 14:35:09 PDT
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? :)
Comment 6 Ryan VanderMeulen [:RyanVM] 2012-07-07 12:03:03 PDT
https://hg.mozilla.org/mozilla-central/rev/db774ca70b42

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