Closed Bug 702799 Opened 13 years ago Closed 13 years ago

Don't change a RefPtr when using the implicit conversion to TemporaryRef

Categories

(Core :: MFBT, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla11

People

(Reporter: joe, Assigned: joe)

Details

Attachments

(1 file)

Right now |RefPtr::operator TemporaryRef<U>()| calls forget() on |this|, which sets ptr to NULL. This is highly unexpected. This patch fixes it.
Attachment #574704 - Flags: review?(jones.chris.g)
Comment on attachment 574704 [details] [diff] [review]
don't call forget

For reference: bug 661973 comment 37.  Joe brought up the example of

TemporaryRef<Foo>
Bar()
{
  return mFoo;
}

nulling out mFoo, which I agree is a convincing example that this operator is counter-intuitive.  Sold.
Attachment #574704 - Flags: review?(jones.chris.g) → review+
Try run for 066438f1bf60 is complete.
Detailed breakdown of the results available here:
    https://tbpl.mozilla.org/?tree=Try&rev=066438f1bf60
Results (out of 93 total builds):
    success: 83
    warnings: 9
    failure: 1
Builds available at http://ftp.mozilla.org/pub/mozilla.org/firefox/try-builds/jdrew@mozilla.com-066438f1bf60
Pushed to inbound: https://hg.mozilla.org/integration/mozilla-inbound/rev/3b3c9e09abe3
Assignee: nobody → joe
Target Milestone: --- → mozilla11
https://hg.mozilla.org/mozilla-central/rev/3b3c9e09abe3
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Component: XPCOM → MFBT
OS: Mac OS X → All
QA Contact: xpcom → mfbt
Hardware: x86 → All
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: