X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/684242c6d81bdde114bb8fcd65249b8fe0b05839..10769d8c47c21fe0ec5034726791a5ad4cf19475:/include/wx/object.h?ds=sidebyside diff --git a/include/wx/object.h b/include/wx/object.h index 2892637645..7c161ab113 100644 --- a/include/wx/object.h +++ b/include/wx/object.h @@ -72,16 +72,28 @@ public: , m_baseInfo1(0) , m_baseInfo2(0) , m_next(sm_first) + { sm_first = this; } + + ~wxClassInfo() + { + if (sm_first == this) { -#ifdef __WXDEBUG__ - if (sm_classTable != NULL) { - wxString msg(_T("too late binding of class info (lazy binding) for ")); - msg += className; - wxFAIL_MSG(msg); + sm_first = m_next; + } + else + { + wxClassInfo * info = sm_first; + while (info) + { + if (info->m_next == this) + { + info->m_next = m_next; + break; + } + info = info->m_next; } -#endif - sm_first = this; } + } wxObject *CreateObject() { return m_objectConstructor ? (*m_objectConstructor)() : 0; } @@ -411,12 +423,29 @@ inline void wxCheckCast(void *ptr) class WXDLLEXPORT wxObject { DECLARE_ABSTRACT_CLASS(wxObject) - DECLARE_NO_COPY_CLASS(wxObject) +private: + void InitFrom(const wxObject& other); + public: wxObject() { m_refData = NULL; } virtual ~wxObject() { UnRef(); } + wxObject(const wxObject& other) + { + InitFrom(other); + } + + wxObject& operator=(const wxObject& other) + { + if ( this != &other ) + { + UnRef(); + InitFrom(other); + } + return *this; + } + bool IsKindOf(wxClassInfo *info) const;