check for self-assignment in operator=
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69817 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
ababdf5ffd
commit
701871dc87
@ -458,15 +458,17 @@ wxRect wxRegionIterator::GetRect() const
|
||||
|
||||
wxRegionIterator& wxRegionIterator::operator=(const wxRegionIterator& ri)
|
||||
{
|
||||
wxDELETEA(m_rects);
|
||||
|
||||
m_current = ri.m_current;
|
||||
m_numRects = ri.m_numRects;
|
||||
if ( m_numRects )
|
||||
if (this != &ri)
|
||||
{
|
||||
m_rects = new wxRect[m_numRects];
|
||||
memcpy(m_rects, ri.m_rects, m_numRects * sizeof m_rects[0]);
|
||||
}
|
||||
wxDELETEA(m_rects);
|
||||
|
||||
m_current = ri.m_current;
|
||||
m_numRects = ri.m_numRects;
|
||||
if ( m_numRects )
|
||||
{
|
||||
m_rects = new wxRect[m_numRects];
|
||||
memcpy(m_rects, ri.m_rects, m_numRects * sizeof m_rects[0]);
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user