mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-26 04:09:50 +00:00
Bug 821804 - Allow unitialized WeakPtrs to work properly. r=Waldo
This ensures that the WeakPtr always points at a valid object and avoids the need to test for that during operations.
This commit is contained in:
parent
77c26d6ed3
commit
a4467e34c9
@ -113,7 +113,8 @@ class WeakPtr
|
||||
{
|
||||
public:
|
||||
WeakPtr(const WeakPtr<T>& o) : ref(o.ref) {}
|
||||
WeakPtr() : ref(nullptr) {}
|
||||
// Ensure that ref is dereferenceable in the uninitialized state
|
||||
WeakPtr() : ref(new typename SupportsWeakPtr<T>::WeakReference(nullptr)) {}
|
||||
|
||||
operator T*() const {
|
||||
return ref->get();
|
||||
|
Loading…
x
Reference in New Issue
Block a user