X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a2d03e4c51b2142e17162cf5a7f9e877b652ca95..ca77701441e39245dcbfce903049e76f166979e5:/include/wx/scopedptr.h?ds=inline diff --git a/include/wx/scopedptr.h b/include/wx/scopedptr.h index 515c7fc383..f31a4ef036 100644 --- a/include/wx/scopedptr.h +++ b/include/wx/scopedptr.h @@ -43,7 +43,7 @@ public: wxEXPLICIT wxScopedPtr(T * ptr = NULL) : m_ptr(ptr) { } - ~wxScopedPtr() { delete m_ptr; } + ~wxScopedPtr() { wxCHECKED_DELETE(m_ptr); } // test for pointer validity: defining conversion to unspecified_bool_type // and not more obvious bool to avoid implicit conversions to integer types @@ -63,7 +63,7 @@ public: { if ( ptr != m_ptr ) { - delete m_ptr; + wxCHECKED_DELETE(m_ptr); m_ptr = ptr; } } @@ -129,14 +129,7 @@ public: \ \ ~name(); \ \ - void reset(T * ptr = NULL) \ - { \ - if (m_ptr != ptr) \ - { \ - delete m_ptr; \ - m_ptr = ptr; \ - } \ - } \ + void reset(T * ptr = NULL); \ \ T *release() \ { \ @@ -171,6 +164,14 @@ public: \ }; #define wxDEFINE_SCOPED_PTR(T, name)\ +void name::reset(T * ptr) \ +{ \ + if (m_ptr != ptr) \ + { \ + wxCHECKED_DELETE(m_ptr); \ + m_ptr = ptr; \ + } \ +} \ name::~name() \ { \ wxCHECKED_DELETE(m_ptr); \