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;
#endif
-
#ifdef _WX_WANT_NEW_SIZET_WXCHAR_INT
void *wxObject::operator new ( size_t size, const wxChar *fileName, int lineNum )
{
// ----------------------------------------------------------------------------
-// wxClassInfo
+// wxObject
// ----------------------------------------------------------------------------
+// Initialize ref data from another object (needed for copy constructor and
+// assignment operator)
+void wxObject::InitFrom(const wxObject& other)
+{
+ m_refData = other.m_refData;
+ if ( m_refData )
+ m_refData->m_count++;
+}
+
void wxObject::Ref(const wxObject& clone)
{
#if defined(__WXDEBUG__) || wxUSE_DEBUG_CONTEXT