Closed Bug 1121489 Opened 10 years ago Closed 10 years ago

Make it possible to construct a RefPtr from an already_AddRefed; r=froydnj

Categories

(Core :: MFBT, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla38

People

(Reporter: ehsan.akhgari, Assigned: ehsan.akhgari)

References

Details

Attachments

(1 file, 1 obsolete file)

This will pave the way towards having a MakeAndAddRef function that returns an already_AddRefed and can be used in graphics code.
Assignee: nobody → ehsan
Blocks: 1116905
Attachment #8548910 - Flags: review?(nfroyd)
Comment on attachment 8548910 [details] [diff] [review] Make it possible to construct a RefPtr from an already_AddRefed Review of attachment 8548910 [details] [diff] [review]: ----------------------------------------------------------------- Um, this compiles? already_AddRefed::take is non-const.
Attachment #8548910 - Flags: review?(nfroyd)
(In reply to Nathan Froyd [:froydnj] [:nfroyd] from comment #2) > Comment on attachment 8548910 [details] [diff] [review] > Make it possible to construct a RefPtr from an already_AddRefed > > Review of attachment 8548910 [details] [diff] [review]: > ----------------------------------------------------------------- > > Um, this compiles? already_AddRefed::take is non-const. Sigh, templates. Yes, you're right, but the compiler didn't know this because I had yet to instantiate the constructor!
This will pave the way towards having a MakeAndAddRef function that returns an already_AddRefed and can be used in graphics code.
Attachment #8550791 - Flags: review?(nfroyd)
Attachment #8548910 - Attachment is obsolete: true
Comment on attachment 8550791 [details] [diff] [review] Make it possible to construct a RefPtr from an already_AddRefed Review of attachment 8550791 [details] [diff] [review]: ----------------------------------------------------------------- r=me with fixing the compile error. ::: mfbt/RefPtr.h @@ +255,5 @@ > return *this; > } > + RefPtr& operator=(const already_AddRefed<T>& aOther) > + { > + assign(aOther.take()); ...and I guess this doesn't compile, either, because |take()| is non-const?
Attachment #8550791 - Flags: review?(nfroyd) → review+
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla38
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: