X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/807d848702772c7dc59e7a2bb35b2971ad86a64d..2c892c0b0cf6ef67614413c0d927eeefefe63ece:/src/common/object.cpp diff --git a/src/common/object.cpp b/src/common/object.cpp index d502615e27..7bf7dbdc11 100644 --- a/src/common/object.cpp +++ b/src/common/object.cpp @@ -230,6 +230,10 @@ void wxObject::Ref(const wxObject& clone) DEBUG_PRINTF(wxObject::Ref) #endif + // nothing to be done + if (m_refData == clone.m_refData) + return; + // delete reference to old data UnRef(); @@ -262,7 +266,7 @@ void wxObject::AllocExclusive() else if ( m_refData->GetRefCount() > 1 ) { // note that ref is not going to be destroyed in this case - wxObjectRefData* ref = m_refData; + const wxObjectRefData* ref = m_refData; UnRef(); // ... so we can still access it @@ -276,11 +280,18 @@ void wxObject::AllocExclusive() wxObjectRefData *wxObject::CreateRefData() const { + // if you use AllocExclusive() you must override this method + wxFAIL_MSG( _T("CreateRefData() must be overridden if called!") ); + return NULL; } -wxObjectRefData *wxObject::CloneRefData(wxObjectRefData * WXUNUSED(data)) const +wxObjectRefData * +wxObject::CloneRefData(const wxObjectRefData * WXUNUSED(data)) const { + // if you use AllocExclusive() you must override this method + wxFAIL_MSG( _T("CloneRefData() must be overridden if called!") ); + return NULL; }