From b021c3c9380ae03c1888afecfd525c26d2d8af38 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 16 Nov 2020 01:50:27 +0100 Subject: [PATCH] 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. --- include/wx/weakref.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/include/wx/weakref.h b/include/wx/weakref.h index f674f0d996..25e2306f87 100644 --- a/include/wx/weakref.h +++ b/include/wx/weakref.h @@ -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(m_pobj); - wxASSERT(pt); pt->RemoveNode(this); m_pobj = NULL; }