Last Comment Bug 702799 - Don't change a RefPtr when using the implicit conversion to TemporaryRef
: Don't change a RefPtr when using the implicit conversion to TemporaryRef
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: MFBT (show other bugs)
: Trunk
: All All
: -- normal (vote)
: mozilla11
Assigned To: Joe Drew (not getting mail)
:
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-11-15 15:02 PST by Joe Drew (not getting mail)
Modified: 2012-02-01 13:59 PST (History)
5 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
don't call forget (744 bytes, patch)
2011-11-15 15:02 PST, Joe Drew (not getting mail)
cjones.bugs: review+
Details | Diff | Splinter Review

Description Joe Drew (not getting mail) 2011-11-15 15:02:49 PST
Created attachment 574704 [details] [diff] [review]
don't call forget

Right now |RefPtr::operator TemporaryRef<U>()| calls forget() on |this|, which sets ptr to NULL. This is highly unexpected. This patch fixes it.
Comment 1 Chris Jones [:cjones] inactive; ni?/f?/r? if you need me 2011-11-15 18:43:09 PST
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.
Comment 2 Mozilla RelEng Bot 2011-11-15 20:50:34 PST
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
Comment 3 Joe Drew (not getting mail) 2011-11-21 13:44:03 PST
Pushed to inbound: https://hg.mozilla.org/integration/mozilla-inbound/rev/3b3c9e09abe3
Comment 4 Ed Morley [:emorley] 2011-11-21 19:06:53 PST
https://hg.mozilla.org/mozilla-central/rev/3b3c9e09abe3

Note You need to log in before you can comment on or make changes to this bug.