X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/906c935a80b10d53cecf57f71ab5f3f4f1d529ec..20125017a4bccd0920ee21e178950b0de0e4d63b:/src/xml/xml.cpp diff --git a/src/xml/xml.cpp b/src/xml/xml.cpp index ee78a9aca4..0fc27c246b 100644 --- a/src/xml/xml.cpp +++ b/src/xml/xml.cpp @@ -91,6 +91,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 +123,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;