Open Bug 1770680 Opened 3 years ago Updated 1 year ago

get() of RefPtr, OwningNonNull and nsCOMPtr are not treated as safe even if they are in the auto storage

Categories

(Core :: MFBT, defect)

defect

Tracking

()

People

(Reporter: masayuki, Unassigned)

References

(Blocks 1 open bug)

Details

RefPtr<T>::get(), OwningNonNull<T>::get() and nsCOMPtr<T>::get() are not treated as safe even if their instances are in the auto storage. Therefore, in the following case:

const bool callWithFoo = something;
const RefPtr<Foo> foo;
MayRunScript(callWithFoo ? foo.get() : nullptr);

needs to be written as:

MayRunScript(MOZ_KnownLive(callWithFoo ? foo.get() : nullptr));
Severity: -- → S4
You need to log in before you can comment on or make changes to this bug.