X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/906c935a80b10d53cecf57f71ab5f3f4f1d529ec..8c6471af3cf87c97f5f1564c601237caf9fdeb60:/src/xml/xml.cpp diff --git a/src/xml/xml.cpp b/src/xml/xml.cpp index ee78a9aca4..665c4b906b 100644 --- a/src/xml/xml.cpp +++ b/src/xml/xml.cpp @@ -3,7 +3,6 @@ // Purpose: wxXmlDocument - XML parser & data holder class // Author: Vaclav Slavik // Created: 2000/03/05 -// RCS-ID: $Id$ // Copyright: (c) 2000 Vaclav Slavik // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -91,6 +90,22 @@ wxXmlNode::wxXmlNode(const wxXmlNode& node) } wxXmlNode::~wxXmlNode() +{ + DoFree(); +} + +wxXmlNode& wxXmlNode::operator=(const wxXmlNode& node) +{ + if ( &node != this ) + { + DoFree(); + DoCopy(node); + } + + return *this; +} + +void wxXmlNode::DoFree() { wxXmlNode *c, *c2; for (c = m_children; c; c = c2) @@ -107,14 +122,6 @@ wxXmlNode::~wxXmlNode() } } -wxXmlNode& wxXmlNode::operator=(const wxXmlNode& node) -{ - wxDELETE(m_attrs); - wxDELETE(m_children); - DoCopy(node); - return *this; -} - void wxXmlNode::DoCopy(const wxXmlNode& node) { m_type = node.m_type;