Closed Bug 345123 Opened 18 years ago Closed 10 years ago

Why does class nsGetterAddRefs<T> have an nsISupports**() operator anyway?

Categories

(Core :: XPCOM, defect, P5)

defect

Tracking

()

RESOLVED FIXED
mozilla30

People

(Reporter: neil, Assigned: khuey)

References

Details

Attachments

(1 file)

Spun off from bug 344949 comment 7.

Bug 344949 was caused by the following code snippet:
  nsCOMPtr<nsIXULTemplateResult> nextresult;
  rv = results->GetNext(getter_AddRefs(nextresult));
GetNext takes an nsISupports** so this construct reinterpreted the return value as an nsIXULTemplateResult. This was not noticed at the time because a) the code compiles (which is this bug) and b) it was only tested using an enumerator that enumerated objects whose nsISupports pointer was statically cast from their nsIXULTemplateResult pointer.
(In reply to comment #0)
> Spun off from bug 344949 comment 7.

I think you mean bug 344939 comment 7 :)
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P5
Attached patch PatchSplinter Review
Yeah, this operator nsISupports** is crazy.
Assignee: nobody → khuey
Status: NEW → ASSIGNED
Attachment #820770 - Flags: review?(benjamin)
Comment on attachment 820770 [details] [diff] [review]
Patch

There are a lot of calls to ReadObject there. Maybe we should change the signature to void readObject(in boolean aIsStrongRef, in nsIIDRef uuid, [retval, iid_is(uuid)] out nsQIResult object);
Perhaps.  I'd prefer to do that elsewhere though.
Attachment #820770 - Flags: review?(benjamin) → review+
This looks great, but I don't understand why you're commenting the method out instead of removing it.
Oh, yeah, that's silly.  I'll actually remove it when I land.
(In reply to comment #6)
> Oh, yeah, that's silly.  I'll actually remove it when I land.

You rock!
Why is this not landed yet?
Flags: needinfo?(khuey)
Because I forgot about it.  I'll land it next time I push.
Flags: needinfo?(khuey)
https://hg.mozilla.org/mozilla-central/rev/1123c64bca9e
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
Target Milestone: --- → mozilla30
Depends on: 984110
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: