X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7c74e7fe1de14f32dcd6f3c9cdd727de540bbd0e..7b9da2077d0975db6c965a85c91d5aca671ab5e3:/src/common/object.cpp diff --git a/src/common/object.cpp b/src/common/object.cpp index 44d3f3f3a6..de51bf7c62 100644 --- a/src/common/object.cpp +++ b/src/common/object.cpp @@ -355,13 +355,15 @@ void wxObject::Ref(const wxObject& clone) void wxObject::UnRef() { - if (m_refData) { - assert(m_refData->m_count > 0); - --(m_refData->m_count); - if (m_refData->m_count == 0) + if ( m_refData ) + { + wxASSERT_MSG( m_refData->m_count > 0, _T("invalid ref data count") ); + + if ( !--m_refData->m_count ) delete m_refData; + + m_refData = (wxObjectRefData *) NULL; } - m_refData = (wxObjectRefData *) NULL; } /*