Loading include/utils/RefBase.h +8 −2 Original line number Diff line number Diff line Loading @@ -51,7 +51,6 @@ inline bool operator _op_ (const U* o) const { \ } // --------------------------------------------------------------------------- class ReferenceMover; class ReferenceConverterBase { public: Loading Loading @@ -121,6 +120,13 @@ protected: RefBase(); virtual ~RefBase(); // called when the last reference goes away. this is responsible for // calling the destructor. The default implementation just does // "delete this;". // Make sure to never acquire a strong reference from this function. The // same restrictions than for destructors apply. virtual void destroy() const; //! Flags for extendObjectLifetime() enum { OBJECT_LIFETIME_WEAK = 0x0001, Loading libs/utils/RefBase.cpp +5 −1 Original line number Diff line number Diff line Loading @@ -345,6 +345,10 @@ void RefBase::incStrong(const void* id) const const_cast<RefBase*>(this)->onFirstRef(); } void RefBase::destroy() const { delete this; } void RefBase::decStrong(const void* id) const { weakref_impl* const refs = mRefs; Loading @@ -357,7 +361,7 @@ void RefBase::decStrong(const void* id) const if (c == 1) { const_cast<RefBase*>(this)->onLastStrongRef(id); if ((refs->mFlags&OBJECT_LIFETIME_WEAK) != OBJECT_LIFETIME_WEAK) { delete this; destroy(); } } refs->decWeak(id); Loading Loading
include/utils/RefBase.h +8 −2 Original line number Diff line number Diff line Loading @@ -51,7 +51,6 @@ inline bool operator _op_ (const U* o) const { \ } // --------------------------------------------------------------------------- class ReferenceMover; class ReferenceConverterBase { public: Loading Loading @@ -121,6 +120,13 @@ protected: RefBase(); virtual ~RefBase(); // called when the last reference goes away. this is responsible for // calling the destructor. The default implementation just does // "delete this;". // Make sure to never acquire a strong reference from this function. The // same restrictions than for destructors apply. virtual void destroy() const; //! Flags for extendObjectLifetime() enum { OBJECT_LIFETIME_WEAK = 0x0001, Loading
libs/utils/RefBase.cpp +5 −1 Original line number Diff line number Diff line Loading @@ -345,6 +345,10 @@ void RefBase::incStrong(const void* id) const const_cast<RefBase*>(this)->onFirstRef(); } void RefBase::destroy() const { delete this; } void RefBase::decStrong(const void* id) const { weakref_impl* const refs = mRefs; Loading @@ -357,7 +361,7 @@ void RefBase::decStrong(const void* id) const if (c == 1) { const_cast<RefBase*>(this)->onLastStrongRef(id); if ((refs->mFlags&OBJECT_LIFETIME_WEAK) != OBJECT_LIFETIME_WEAK) { delete this; destroy(); } } refs->decWeak(id); Loading