Remove useless asserts from wxWeakRef implementation

No real changes, just remove asserts verifying that a pointer is
non-null right before dereferencing it, as they're perfectly useless for
all the usual reasons and just add extra code to relatively often used
functions.
This commit is contained in:
Vadim Zeitlin
2020-11-16 01:50:27 +01:00
parent 84409dfa0a
commit b021c3c938

View File

@@ -118,7 +118,6 @@ protected:
if ( pobj )
{
// Add ourselves to object tracker list
wxASSERT( ptbase );
ptbase->AddNode( this );
m_pobj = pobj;
m_ptbase = ptbase;
@@ -153,8 +152,8 @@ public:
virtual ~wxWeakRefDynamic() { Release(); }
// Smart pointer functions
T& operator*() const { wxASSERT(m_pobj); return *m_pobj; }
T* operator->() const { wxASSERT(m_pobj); return m_pobj; }
T& operator*() const { return *m_pobj; }
T* operator->() const { return m_pobj; }
T* get() const { return m_pobj; }
operator T* () const { return m_pobj; }
@@ -171,7 +170,6 @@ public:
{
// Remove ourselves from object tracker list
wxTrackable *pt = dynamic_cast<wxTrackable*>(m_pobj);
wxASSERT(pt);
pt->RemoveNode(this);
m_pobj = NULL;
}