[1660792 ] wxObject::Dec/IncRef and wxObjectDataPtr

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44521 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2007-02-17 09:16:35 +00:00
parent c71b212607
commit 4a11340a1c
3 changed files with 110 additions and 9 deletions

View File

@@ -289,6 +289,17 @@ wxObject *wxCreateDynamicObject(const wxChar *name)
}
// ----------------------------------------------------------------------------
// wxObjectRefData
// ----------------------------------------------------------------------------
void wxObjectRefData::DecRef()
{
if ( --m_count == 0 )
delete this;
}
// ----------------------------------------------------------------------------
// wxObject
// ----------------------------------------------------------------------------
@@ -310,7 +321,7 @@ void wxObject::Ref(const wxObject& clone)
if ( clone.m_refData )
{
m_refData = clone.m_refData;
++(m_refData->m_count);
m_refData->IncRef();
}
}
@@ -320,8 +331,7 @@ void wxObject::UnRef()
{
wxASSERT_MSG( m_refData->m_count > 0, _T("invalid ref data count") );
if ( --m_refData->m_count == 0 )
delete m_refData;
m_refData->DecRef();
m_refData = NULL;
}
}