]> git.saurik.com Git - wxWidgets.git/commitdiff
check for self-assignment in operator=
authorPaul Cornett <paulcor@bullseye.com>
Thu, 19 Feb 2009 07:36:27 +0000 (07:36 +0000)
committerPaul Cornett <paulcor@bullseye.com>
Thu, 19 Feb 2009 07:36:27 +0000 (07:36 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59019 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/geometry.h

index 80ab7d9bd20b7affdb6df255136e0e12c2cea098..11073dc02beafad0bb54c35761446c375ac9ed4e 100644 (file)
@@ -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;
 }