Only provide one explicit function for converting a WeakPtrBase into a T*

NEW
Unassigned

Status

()

Core
MFBT
5 years ago
5 years ago

People

(Reporter: Ehsan, Unassigned)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

5 years ago
See bug 923554 for the reasoning.  Specifically I think we should remove all three operators from that class and stick to calling get() explicitly.
(Reporter)

Comment 1

5 years ago
Created attachment 814611 [details] [diff] [review]
WIP!

I took a stab at this.  Of course this breaks the build in all sorts of ways, and the code using WeakPtr should be audited carefully to see if the weak pointers are being used in safe ways.
(Reporter)

Comment 2

5 years ago
I posted about this to dev.platform.
Don't forget to update the example code using a WeakPtr in a boolean context! :)

https://hg.mozilla.org/mozilla-central/file/552bca1bc885/mfbt/WeakPtr.h#l43
OS: Mac OS X → All
Hardware: x86 → All
(Reporter)

Comment 4

5 years ago
(In reply to comment #3)
> Don't forget to update the example code using a WeakPtr in a boolean context!
> :)
> 
> https://hg.mozilla.org/mozilla-central/file/552bca1bc885/mfbt/WeakPtr.h#l43

Haha good catch, we should probably do a SafeBool thingy here <http://www.artima.com/cppsource/safebool.html>
You need to log in before you can comment on or make changes to this bug.