]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix wxXmlNode self-assignment.
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 15 May 2013 21:45:25 +0000 (21:45 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 15 May 2013 21:45:25 +0000 (21:45 +0000)
Don't lose the node contents if it's assigned to itself.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73992 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/xml/xml.cpp

index 6e2dbf6c96d0cc0aa59cbcb60be547c64ceb59dd..0fc27c246b23f0ff25c50347fd33ea828fc46bf7 100644 (file)
@@ -97,8 +97,12 @@ wxXmlNode::~wxXmlNode()
 
 wxXmlNode& wxXmlNode::operator=(const wxXmlNode& node)
 {
-    DoFree();
-    DoCopy(node);
+    if ( &node != this )
+    {
+        DoFree();
+        DoCopy(node);
+    }
+
     return *this;
 }