X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/46a1983ae4a56bfa64b7dcc171f7d996cd980d8c..cf1a582ab947647cd17ad481c1b95e51b211ffcc:/src/gtk/region.cpp?ds=sidebyside diff --git a/src/gtk/region.cpp b/src/gtk/region.cpp index 1f22346b7b..92ec47f1e7 100644 --- a/src/gtk/region.cpp +++ b/src/gtk/region.cpp @@ -458,20 +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 ) - { - m_rects = new wxRect[m_numRects]; - for ( int n = 0; n < m_numRects; n++ ) - m_rects[n] = ri.m_rects[n]; - } - else + if (this != &ri) { - m_rects = NULL; - } + 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; }