Closed Bug 657210 Opened 13 years ago Closed 13 years ago

Outparamdel nsEditor::GetPresShell

Categories

(Core :: DOM: Editor, defect)

defect
Not set
minor

Tracking

()

VERIFIED FIXED
mozilla6

People

(Reporter: Ms2ger, Assigned: Ms2ger)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Attached patch Patch v1Splinter Review
Barely any consumer checks the nsresult return value. I hope you like.
Attachment #532511 - Flags: review?(ehsan)
Flags: in-testsuite-
Do we really need to addref on this method?
Comment on attachment 532511 [details] [diff] [review]
Patch v1

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

::: editor/libeditor/base/nsEditor.cpp
@@ +537,5 @@
>    NS_PRECONDITION(mDocWeak, "bad state, null mDocWeak");
>    nsCOMPtr<nsIDocument> doc = do_QueryReferent(mDocWeak);
> +  NS_ENSURE_TRUE(doc, NULL);
> +  nsRefPtr<nsIPresShell> ps = doc->GetShell();
> +  return ps.forget();

Can't you just say:

return doc->GetShell()
Attachment #532511 - Flags: review?(ehsan) → review+
(In reply to comment #2)
> ::: editor/libeditor/base/nsEditor.cpp
> @@ +537,5 @@
> >    NS_PRECONDITION(mDocWeak, "bad state, null mDocWeak");
> >    nsCOMPtr<nsIDocument> doc = do_QueryReferent(mDocWeak);
> > +  NS_ENSURE_TRUE(doc, NULL);
> > +  nsRefPtr<nsIPresShell> ps = doc->GetShell();
> > +  return ps.forget();
> 
> Can't you just say:
> 
> return doc->GetShell()

Well, of course you can't! :D

Can you just use nsCOMPtr?  r=me with that.
(In reply to comment #1)
> Do we really need to addref on this method?

It might be needed in some of the cases.  We can investigate the possibility of avoiding that in another bug.
http://hg.mozilla.org/mozilla-central/rev/6a76f02f19e1
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla6
(In reply to comment #3)
> Can you just use nsCOMPtr?  r=me with that.

And because I forgot you said this:

http://hg.mozilla.org/mozilla-central/rev/5e204a657cac
Setting resolution to Verified Fixed on Mozilla/5.0 (Windows NT 6.1; rv:6.0) Gecko/20100101 Firefox/6.0b3
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: