X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ababdf5ffd2832eb96f1a6b94cbb325ed74dbcad..a9ed8caa09bc542a2ad9f752c0a6ca63c7119747:/src/gtk/region.cpp?ds=sidebyside diff --git a/src/gtk/region.cpp b/src/gtk/region.cpp index dcf7ee5b2b..92ec47f1e7 100644 --- a/src/gtk/region.cpp +++ b/src/gtk/region.cpp @@ -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; }