X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7c74e7fe1de14f32dcd6f3c9cdd727de540bbd0e..270a909e20a2c652fd816ad14407113ad0319c9d:/src/common/object.cpp diff --git a/src/common/object.cpp b/src/common/object.cpp index 44d3f3f3a6..d70fdbd253 100644 --- a/src/common/object.cpp +++ b/src/common/object.cpp @@ -275,7 +275,6 @@ wxObject *wxCreateDynamicObject(const wxChar *name) } return (wxObject*) NULL; } - return (wxObject*) NULL; } #if wxUSE_SERIAL @@ -355,13 +354,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; } /*