From 7c562ad9aa6bc343e99cbc01d6c747613b6717b2 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Thu, 19 Feb 2009 07:36:27 +0000 Subject: [PATCH] check for self-assignment in operator= git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59019 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/geometry.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/include/wx/geometry.h b/include/wx/geometry.h index 80ab7d9bd2..11073dc02b 100644 --- a/include/wx/geometry.h +++ b/include/wx/geometry.h @@ -182,8 +182,11 @@ inline wxPoint2DInt wxPoint2DInt::operator-() inline wxPoint2DInt& wxPoint2DInt::operator=(const wxPoint2DInt& pt) { - m_x = pt.m_x; - m_y = pt.m_y; + if (this != &pt) + { + m_x = pt.m_x; + m_y = pt.m_y; + } return *this; } @@ -411,8 +414,11 @@ inline wxPoint2DDouble wxPoint2DDouble::operator-() inline wxPoint2DDouble& wxPoint2DDouble::operator=(const wxPoint2DDouble& pt) { - m_x = pt.m_x; - m_y = pt.m_y; + if (this != &pt) + { + m_x = pt.m_x; + m_y = pt.m_y; + } return *this; } -- 2.45.2