]> git.saurik.com Git - wxWidgets.git/blobdiff - src/xrc/xml.cpp
added an explicit accessor to query the default key value
[wxWidgets.git] / src / xrc / xml.cpp
index d6ba14d820a58083a769f45acbdae91f3d6961fd..bc3bc6af58c389cd41e217954ad1ef797e569444 100644 (file)
@@ -71,10 +71,29 @@ wxXmlNode::wxXmlNode(const wxXmlNode& node)
 
 
 
+wxXmlNode::~wxXmlNode()
+{
+    wxXmlNode *c, *c2;
+    for (c = m_children; c; c = c2)
+    {
+        c2 = c->m_next;
+        delete c;
+    }
+
+    wxXmlProperty *p, *p2;
+    for (p = m_properties; p; p = p2)
+    {
+        p2 = p->GetNext();
+        delete p;
+    }
+}
+
+
+
 wxXmlNode& wxXmlNode::operator=(const wxXmlNode& node)
 {
-    delete m_properties;
-    delete m_children;
+    wxDELETE(m_properties);
+    wxDELETE(m_children);
     DoCopy(node);
     return *this;
 }
@@ -237,12 +256,14 @@ void wxXmlNode::AddProperty(wxXmlProperty *prop)
 
 bool wxXmlNode::DeleteProperty(const wxString& name)
 {
+    wxXmlProperty *prop;
+
     if (m_properties == NULL)
         return FALSE;
 
     else if (m_properties->GetName() == name)
     {
-        wxXmlProperty *prop = m_properties;
+        prop = m_properties;
         m_properties = prop->GetNext();
         prop->SetNext(NULL);
         delete prop;
@@ -256,7 +277,7 @@ bool wxXmlNode::DeleteProperty(const wxString& name)
         {
             if (p->GetNext()->GetName() == name)
             {
-                wxXmlProperty *prop = p->GetNext();
+                prop = p->GetNext();
                 p->SetNext(prop->GetNext());
                 prop->SetNext(NULL);
                 delete prop;
@@ -284,8 +305,7 @@ wxXmlDocument::wxXmlDocument(const wxString& filename, wxXmlIOType io_type)
 {
     if (!Load(filename, io_type))
     {
-        delete m_root;
-        m_root = NULL;
+        wxDELETE(m_root);
     }
 }
 
@@ -296,8 +316,7 @@ wxXmlDocument::wxXmlDocument(wxInputStream& stream, wxXmlIOType io_type)
 {
     if (!Load(stream, io_type))
     {
-        delete m_root;
-        m_root = NULL;
+        wxDELETE(m_root);
     }
 }
 
@@ -312,7 +331,7 @@ wxXmlDocument::wxXmlDocument(const wxXmlDocument& doc)
 
 wxXmlDocument& wxXmlDocument::operator=(const wxXmlDocument& doc)
 {
-    delete m_root;
+    wxDELETE(m_root);
     DoCopy(doc);
     return *this;
 }
@@ -398,8 +417,7 @@ void wxXmlDocument::AddHandler(wxXmlIOHandler *handler)
 
 void wxXmlDocument::CleanUpHandlers()
 {
-    delete sm_handlers;
-    sm_handlers = NULL;
+    wxDELETE(sm_handlers);
 }