FastLED 3.9.15
Loading...
Searching...
No Matches

◆ lock()

template<typename T>
Ptr< T > fl::WeakPtr< T >::lock ( ) const
inline

Definition at line 369 of file ptr.h.

369 {
370 if (!mWeakPtr) {
371 return Ptr<T>();
372 }
373 T *out = static_cast<T *>(mWeakPtr->getReferent());
374 if (out->ref_count() == 0) {
375 // This is a static object, so the refcount is 0.
376 return Ptr<T>::NoTracking(*out);
377 }
378 // This is a heap object, so we need to ref it.
379 return Ptr<T>::TakeOwnership(static_cast<T *>(out));
380 }
static Ptr TakeOwnership(T *ptr)
Definition ptr.h:127
static Ptr NoTracking(T &referent)
Definition ptr.h:132
Ptr< WeakReferent > mWeakPtr
Definition ptr.h:397

References mWeakPtr, fl::Ptr< T >::NoTracking(), and fl::Ptr< T >::TakeOwnership().

Referenced by operator==().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: