Ref counting fixes and compile fixes.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13989 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling 2002-02-04 10:42:16 +00:00
parent 45e0dc9477
commit e0f0b19775
5 changed files with 33 additions and 1 deletions

View File

@ -115,6 +115,10 @@ public:
GdkRegion *GetRegion() const; GdkRegion *GetRegion() const;
protected: protected:
// ref counting code
virtual wxObjectRefData *CreateRefData() const;
virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
// common part of ctors for a rectangle region // common part of ctors for a rectangle region
void InitRect(wxCoord x, wxCoord y, wxCoord w, wxCoord h); void InitRect(wxCoord x, wxCoord y, wxCoord w, wxCoord h);

View File

@ -115,6 +115,10 @@ public:
GdkRegion *GetRegion() const; GdkRegion *GetRegion() const;
protected: protected:
// ref counting code
virtual wxObjectRefData *CreateRefData() const;
virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
// common part of ctors for a rectangle region // common part of ctors for a rectangle region
void InitRect(wxCoord x, wxCoord y, wxCoord w, wxCoord h); void InitRect(wxCoord x, wxCoord y, wxCoord w, wxCoord h);

View File

@ -282,7 +282,7 @@ wxObjectRefData *wxObject::CreateRefData() const
return NULL; 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 // if you use AllocExclusive() you must override this method
wxFAIL_MSG( _T("CloneRefData() must be overridden if called!") ); wxFAIL_MSG( _T("CloneRefData() must be overridden if called!") );

View File

@ -168,8 +168,18 @@ wxRegion::wxRegion( size_t n, const wxPoint *points, int fillStyle )
wxRegion::~wxRegion() wxRegion::~wxRegion()
{ {
// m_refData unrefed in ~wxObject
} }
wxObjectRefData *wxRegion::CreateRefData() const
{
return new wxRegionRefData;
}
wxObjectRefData *wxRegion::CloneRefData(const wxObjectRefData *data) const
{
return new wxRegionRefData(*(wxRegionRefData *)data);
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxRegion comparison // wxRegion comparison
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -202,6 +212,7 @@ bool wxRegion::Union( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
rect.y = y; rect.y = y;
rect.width = width; rect.width = width;
rect.height = height; rect.height = height;
if (!m_refData) if (!m_refData)
{ {
m_refData = new wxRegionRefData(); m_refData = new wxRegionRefData();
@ -277,6 +288,7 @@ bool wxRegion::Intersect( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
bool wxRegion::Intersect( const wxRect& rect ) bool wxRegion::Intersect( const wxRect& rect )
{ {
wxRegion reg( rect ); wxRegion reg( rect );
return Intersect( reg ); return Intersect( reg );
} }

View File

@ -168,8 +168,18 @@ wxRegion::wxRegion( size_t n, const wxPoint *points, int fillStyle )
wxRegion::~wxRegion() wxRegion::~wxRegion()
{ {
// m_refData unrefed in ~wxObject
} }
wxObjectRefData *wxRegion::CreateRefData() const
{
return new wxRegionRefData;
}
wxObjectRefData *wxRegion::CloneRefData(const wxObjectRefData *data) const
{
return new wxRegionRefData(*(wxRegionRefData *)data);
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxRegion comparison // wxRegion comparison
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -202,6 +212,7 @@ bool wxRegion::Union( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
rect.y = y; rect.y = y;
rect.width = width; rect.width = width;
rect.height = height; rect.height = height;
if (!m_refData) if (!m_refData)
{ {
m_refData = new wxRegionRefData(); m_refData = new wxRegionRefData();
@ -277,6 +288,7 @@ bool wxRegion::Intersect( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
bool wxRegion::Intersect( const wxRect& rect ) bool wxRegion::Intersect( const wxRect& rect )
{ {
wxRegion reg( rect ); wxRegion reg( rect );
return Intersect( reg ); return Intersect( reg );
} }