Bug 1672072 - P12. Add constructor for WeakPtr(RefPtr). r=sg

This allows for nice template type deducation.

Differential Revision: https://phabricator.services.mozilla.com/D96368
This commit is contained in:
Jean-Yves Avenard 2020-11-13 04:21:17 +00:00
parent 6fcaf876b9
commit 1b9b84bbce

View file

@ -294,6 +294,8 @@ class WeakPtr {
#endif
}
explicit WeakPtr(const RefPtr<T>& aOther) : WeakPtr(aOther.get()) {}
// Ensure that mRef is dereferenceable in the uninitialized state.
WeakPtr() : mRef(new WeakReference(nullptr)) {}