Closed
Bug 857645
Opened 11 years ago
Closed 11 years ago
Make it possible to copy-initialize an nsCOMPtr from a superclass already_AddRefed
Categories
(Core :: XPCOM, defect)
Tracking
()
RESOLVED
FIXED
mozilla23
People
(Reporter: bzbarsky, Assigned: bzbarsky)
References
Details
Attachments
(1 file, 2 obsolete files)
2.88 KB,
patch
|
ehsan.akhgari
:
review+
|
Details | Diff | Splinter Review |
Basically, want code like this: nsRefPtr<nsTextNode> foo; nsCOMPtr<nsIContent> baz = foo.forget(); to compile. Right now it doesn't.
Assignee | ||
Updated•11 years ago
|
Whiteboard: [need review[ → [need review]
Assignee | ||
Comment 1•11 years ago
|
||
Attachment #732899 -
Flags: review?(ehsan)
Assignee | ||
Updated•11 years ago
|
Assignee: nobody → bzbarsky
Comment 2•11 years ago
|
||
Comment on attachment 732899 [details] [diff] [review] Make it possible to copy-initialize an nsCOMPtr<T> from an already_AddRefed<U> as long as U inherits from T. Review of attachment 732899 [details] [diff] [review]: ----------------------------------------------------------------- ::: xpcom/glue/nsCOMPtr.h @@ +555,5 @@ > + { > + // But make sure that U actually inherits from T, not the > + // other way around. > + T* unused = aSmartPtr.mRawPtr; > + (void) unused; Instead of this, please use a static assert with mozilla::IsBaseOf.
Attachment #732899 -
Flags: review?(ehsan) → review-
Assignee | ||
Comment 3•11 years ago
|
||
Can I use that in nsCOMPtr? If so, happy to do it.
Assignee | ||
Comment 4•11 years ago
|
||
Attachment #733157 -
Flags: review?(ehsan)
Assignee | ||
Updated•11 years ago
|
Attachment #732899 -
Attachment is obsolete: true
Comment 5•11 years ago
|
||
Comment on attachment 733157 [details] [diff] [review] Let's try this Review of attachment 733157 [details] [diff] [review]: ----------------------------------------------------------------- Great, thanks!
Attachment #733157 -
Flags: review?(ehsan) → review+
Assignee | ||
Comment 6•11 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/8396d7543197
Flags: in-testsuite?
Whiteboard: [need review]
Target Milestone: --- → mozilla23
Comment 7•11 years ago
|
||
Backed out in https://hg.mozilla.org/integration/mozilla-inbound/rev/8fc33d047ed6 - nsHTMLEditRules.o was unhappy a la https://tbpl.mozilla.org/php/getParsedLog.php?id=21460075&tree=Mozilla-Inbound
Assignee | ||
Comment 8•11 years ago
|
||
Fix that by making our operator= also accept any relevant already_AddRefed.
Attachment #733750 -
Flags: review?(ehsan)
Comment 9•11 years ago
|
||
Comment on attachment 733750 [details] [diff] [review] Make it possible to copy-initialize an nsCOMPtr<T> from an already_AddRefed<U> as long as U inherits from T. Why do you need to static_cast to T* once you know U is a subclass of T?
Assignee | ||
Comment 10•11 years ago
|
||
Because I'm assigning into an nsISupports*, and U may have ambiguous inheritance from nsISupports, but T is known not to.
Assignee | ||
Updated•11 years ago
|
Attachment #733157 -
Attachment is obsolete: true
Assignee | ||
Updated•11 years ago
|
Whiteboard: [need review]
Updated•11 years ago
|
Attachment #733750 -
Flags: review?(ehsan) → review+
Assignee | ||
Comment 11•11 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/d93dab0b19fc
Flags: in-testsuite? → in-testsuite-
Whiteboard: [need review]
Comment 12•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/d93dab0b19fc
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•