X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/26c66bc6ac1d8be06635ab3bb6831f3de2afbdd3..60913641356f364a5efee5966d3a3b0b48c01001:/include/wx/weakref.h diff --git a/include/wx/weakref.h b/include/wx/weakref.h index af0a6c0817..e0bd1f90dd 100644 --- a/include/wx/weakref.h +++ b/include/wx/weakref.h @@ -59,6 +59,13 @@ public: } } + virtual void OnObjectDestroy() + { + // Tracked object itself removes us from list of trackers + wxASSERT(m_pobj != NULL); + m_pobj = NULL; + } + protected: void Assign(T* pobj) { @@ -82,13 +89,6 @@ protected: Assign( wr.m_pobj ); } - virtual void OnObjectDestroy() - { - // Tracked object itself removes us from list of trackers - wxASSERT( m_pobj!=NULL ); - m_pobj = NULL; - } - T *m_pobj; }; @@ -122,6 +122,14 @@ struct wxWeakRefImpl : public wxTrackerNode } } + virtual void OnObjectDestroy() + { + // Tracked object itself removes us from list of trackers + wxASSERT(m_pobj != NULL); + m_pobj = NULL; + m_ptbase = NULL; + } + protected: wxWeakRefImpl() : m_pobj(NULL), m_ptbase(NULL) { } @@ -177,14 +185,6 @@ protected: } } - virtual void OnObjectDestroy() - { - // Tracked object itself removes us from list of trackers - wxASSERT( m_pobj!=NULL ); - m_pobj = NULL; - m_ptbase = NULL; - } - T *m_pobj; wxTrackable *m_ptbase; }; @@ -225,7 +225,7 @@ public: template wxWeakRef& operator=(TDerived* pobj) { - Assign(pobj); + this->Assign(pobj); return *this; } @@ -293,6 +293,13 @@ public: } } + virtual void OnObjectDestroy() + { + wxASSERT_MSG(m_pobj, "tracked object should have removed us itself"); + + m_pobj = NULL; + } + protected: void Assign(T *pobj) { @@ -320,13 +327,6 @@ protected: } } - virtual void OnObjectDestroy() - { - wxASSERT_MSG( m_pobj, "tracked object should have removed us itself" ); - - m_pobj = NULL; - } - T *m_pobj; };