Closed
Bug 1494765
Opened 7 years ago
Closed 7 years ago
Allow assignment from an nsCOMPtr of a related type
Categories
(Core :: XPCOM, enhancement, P3)
Core
XPCOM
Tracking
()
RESOLVED
FIXED
mozilla64
| Tracking | Status | |
|---|---|---|
| firefox64 | --- | fixed |
People
(Reporter: mccr8, Assigned: mccr8)
References
Details
Attachments
(1 file)
In bug 1493737, Olli didn't like that I was using the ctor and not an assignment operator in cases like this:
nsCOMPtr<Bar> y;
[...]
nsCOMPtr<Foo> x(y);
where Bar is a subclass of Foo. I was doing this because it doesn't actually work to do |nsCOMPtr<Foo> x = y;|, but that's just because nsCOMPtr<> is missing an operator= overload for this case, which RefPtr<> has, so I'll add it, then fix up my patch for the other bug.
| Assignee | ||
Updated•7 years ago
|
Priority: -- → P3
| Assignee | ||
Comment 1•7 years ago
|
||
I don't think the static_asserts are really needed, but other similar code had them so I figured I'd play it safe.
| Assignee | ||
Comment 2•7 years ago
|
||
This adds support for conversion from nsCOMPtr<A> to nsCOMPtr<B> when
A is a subclass of B. There's no reason to not allow this, and RefPtr
already supports this.
Comment 3•7 years ago
|
||
Comment on attachment 9013019 [details]
Bug 1494765 - Allow assignment from an nsCOMPtr of a related type
Nathan Froyd [:froydnj] has approved the revision.
Attachment #9013019 -
Flags: review+
Pushed by amccreight@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/cb01170872de
Allow assignment from an nsCOMPtr of a related type r=froydnj
Backout by nbeleuzu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/825f10de7839
Backed out changeset cb01170872de for bustages on nsCOMPtr.h. CLOSED TREE
| Assignee | ||
Comment 6•7 years ago
|
||
Looks like I forgot MOZ_IMPLICIT for the new move ctor.
Pushed by amccreight@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/3a9818cd5ffa
Allow assignment from an nsCOMPtr of a related type r=froydnj
Comment 8•7 years ago
|
||
| bugherder | ||
Status: NEW → RESOLVED
Closed: 7 years ago
status-firefox64:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla64
You need to log in
before you can comment on or make changes to this bug.
Description
•