diff --git a/src/nvcore/Ptr.h b/src/nvcore/Ptr.h index f260aa4..1d8d9c9 100644 --- a/src/nvcore/Ptr.h +++ b/src/nvcore/Ptr.h @@ -43,8 +43,11 @@ public: /** Delete owned pointer and assign new one. */ void operator=( T * p ) { - delete m_ptr; - m_ptr = p; + if (p != m_ptr) + { + delete m_ptr; + m_ptr = p; + } } /** Member access. */ @@ -249,14 +252,14 @@ public: /** -> operator. */ BaseClass * operator -> () const { - piCheck( m_ptr != NULL ); + nvCheck( m_ptr != NULL ); return m_ptr; } /** * operator. */ BaseClass & operator*() const { - piCheck( m_ptr != NULL ); + nvCheck( m_ptr != NULL ); return *m_ptr; }