Closed
Bug 489705
Opened 16 years ago
Closed 16 years ago
nsRefPtr should be able to forget a base class to a pure virtual interface it inherits from
Categories
(Core :: XPCOM, defect)
Core
XPCOM
Tracking
()
RESOLVED
FIXED
mozilla1.9.2a1
People
(Reporter: sdwilsh, Assigned: sdwilsh)
References
Details
Attachments
(1 file, 1 obsolete file)
1.03 KB,
patch
|
benjamin
:
review+
dbaron
:
superreview+
|
Details | Diff | Splinter Review |
say you have an outparm, nsISupports **_retval, and you have some base object that inherits from nsISupports, nsFoo. Right now, you can't do this:
nsRefPtr<nsFoo> foo;
foo.forget(_retval);
Assignee | ||
Comment 1•16 years ago
|
||
This does the trick for me. I'm pushing this to the try server now.
Attachment #374185 -
Flags: superreview?(benjamin)
Attachment #374185 -
Flags: review?(dbaron)
Assignee | ||
Updated•16 years ago
|
Whiteboard: [needs review dbaron][needs sr bsmedberg]
Seems like you should probably get rid of the forget(T**) since this should cover it. (Also, if you're going to ask both benjamin and me for reviews, probably better to swap r/sr.)
And a random thought, in case anybody ever sees it here:
If we ever do the same thing for nsCOMPtr (which might be sensible given that interfaces can inherit from other interfaces), we should have the equivalent of an NSCAP_ASSERT_NO_QUERY_NEEDED on the result.
Assignee | ||
Comment 4•16 years ago
|
||
(In reply to comment #2)
> Seems like you should probably get rid of the forget(T**) since this should
> cover it. (Also, if you're going to ask both benjamin and me for reviews,
> probably better to swap r/sr.)
I didn't want to change too much, even though I was pretty sure it'd be alright to do that. My test compile is doing just fine, and the diff is simpler now :)
Attachment #374185 -
Attachment is obsolete: true
Attachment #374189 -
Flags: superreview?(dbaron)
Attachment #374189 -
Flags: review?(benjamin)
Attachment #374185 -
Flags: superreview?(benjamin)
Attachment #374185 -
Flags: review?(dbaron)
Assignee | ||
Updated•16 years ago
|
Whiteboard: [needs review dbaron][needs sr bsmedberg] → [needs review bsmedberg][needs sr dbaron]
Comment on attachment 374189 [details] [diff] [review]
v1.1
sr=dbaron assuming this passes the try server
You might want to extend the comment to note that |rhs| may be T** or I** where I is a base class of T.
Attachment #374189 -
Flags: superreview?(dbaron) → superreview+
Comment 6•16 years ago
|
||
(In reply to comment #3)
> If we ever do the same thing for nsCOMPtr (which might be sensible given that
> interfaces can inherit from other interfaces), we should have the equivalent of
> an NSCAP_ASSERT_NO_QUERY_NEEDED on the result.
Yeah, I've been hitting this case with nsCOMPtr more and more. Working with nsIWritablePropertyBag and returning it as an nsIPropertyBag is one example. Songbird also has a fair number of interface inheritance so we hit it a fair bit.
Assignee | ||
Updated•16 years ago
|
Whiteboard: [needs review bsmedberg][needs sr dbaron] → [needs review bsmedberg]
Target Milestone: --- → mozilla1.9.2a1
Updated•16 years ago
|
Attachment #374189 -
Flags: review?(benjamin) → review+
Assignee | ||
Updated•16 years ago
|
Whiteboard: [needs review bsmedberg] → [can land]
Assignee | ||
Comment 7•16 years ago
|
||
Updated the comment per comment 5 before pushing.
http://hg.mozilla.org/mozilla-central/rev/ddb8d3efc243
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Whiteboard: [can land]
Updated•16 years ago
|
Component: XP Toolkit/Widgets: XUL → XPCOM
QA Contact: xptoolkit.xul → xpcom
Comment 8•16 years ago
|
||
Note that nsCOMPtr is much harder because of refcnt balancing.
You need to log in
before you can comment on or make changes to this bug.
Description
•