X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/074574b4a6022bd04b3f582b81551e9c75d46b18..80cc5fc7ad102221a1ce9e160eac3c29a0586664:/include/wx/weakref.h?ds=inline diff --git a/include/wx/weakref.h b/include/wx/weakref.h index 74b590d627..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; }; @@ -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; };