summaryrefslogtreecommitdiff
path: root/unoxml
diff options
context:
space:
mode:
authorMichael Stahl <mst@openoffice.org>2010-08-04 17:14:21 +0200
committerMichael Stahl <mst@openoffice.org>2010-08-04 17:14:21 +0200
commitbb1e28717397505acfad1e21994312273880c4fa (patch)
tree61e9619b4fceaee1434e36811d11d04b4c5c9fa7 /unoxml
parent2a77fa44f3b2ccf8bf070e7d7350c801fa560d1d (diff)
sw34bf01: #i112783#: unoxml: apply patch by cmc:
fix memory leak by removing unnecessary DOM::CDocument::m_aNodeRefList.
Diffstat (limited to 'unoxml')
-rw-r--r--unoxml/source/dom/document.cxx38
-rw-r--r--unoxml/source/dom/document.hxx4
-rw-r--r--unoxml/source/dom/node.cxx16
3 files changed, 4 insertions, 54 deletions
diff --git a/unoxml/source/dom/document.cxx b/unoxml/source/dom/document.cxx
index 656aa1cbef6c..fcd43832adf0 100644
--- a/unoxml/source/dom/document.cxx
+++ b/unoxml/source/dom/document.cxx
@@ -53,50 +53,12 @@
namespace DOM
{
- void CDocument::addnode(xmlNodePtr aNode)
- {
- if (aNode != (xmlNodePtr)m_aDocPtr)
- {
- Reference< XNode >* nref = new Reference< XNode >(CNode::get(aNode));
- m_aNodeRefList.push_back(nref);
- }
- }
-
CDocument::~CDocument()
{
- Reference< XNode >* pRef;
- nodereflist_t::const_iterator r = m_aNodeRefList.begin();
- while (r!=m_aNodeRefList.end())
- {
- pRef = *r;
- delete pRef;
- r++;
- }
-
- // get rid of leftover instances, if anybody still holds a
- // reference to one of these, it will be invalid!
- /*
- CNode* aNode = 0;
- nodelist_t::const_iterator i = m_aNodeList.begin();
- while (i!=m_aNodeList.end())
- {
- aNode = CNode::get(*i, sal_False);
- if (aNode != 0)
- {
- // CNode::remove(*i);
- // delete will remove
- delete aNode;
- }
- i++;
- }
- */
-
xmlFreeDoc(m_aDocPtr);
-
}
CDocument::CDocument(xmlDocPtr aDocPtr):
- m_aNodeRefList(),
m_aDocPtr(aDocPtr),
m_streamListeners()
{
diff --git a/unoxml/source/dom/document.hxx b/unoxml/source/dom/document.hxx
index b653619031a1..9a54b1512b16 100644
--- a/unoxml/source/dom/document.hxx
+++ b/unoxml/source/dom/document.hxx
@@ -76,8 +76,6 @@ namespace DOM
typedef set< Reference< XStreamListener > > listenerlist_t;
private:
- nodereflist_t m_aNodeRefList;
-
xmlDocPtr m_aDocPtr;
// datacontrol/source state
@@ -87,8 +85,6 @@ namespace DOM
protected:
CDocument(xmlDocPtr aDocPtr);
- void addnode(xmlNodePtr aNode);
-
public:
virtual ~CDocument();
diff --git a/unoxml/source/dom/node.cxx b/unoxml/source/dom/node.cxx
index 2a03896502a9..412f9982fdc7 100644
--- a/unoxml/source/dom/node.cxx
+++ b/unoxml/source/dom/node.cxx
@@ -209,7 +209,7 @@ namespace DOM
// m_aNodeType = NodeType::NOTATION_NODE;
pNode = static_cast< CNode* >(new CAttr((xmlAttrPtr)aNode));
break;
- // unsopported node types
+ // unsupported node types
case XML_HTML_DOCUMENT_NODE:
case XML_ELEMENT_DECL:
case XML_ATTRIBUTE_DECL:
@@ -219,18 +219,10 @@ namespace DOM
pNode = 0;
break;
}
- }
- if ( pNode != 0 )
- {
- if(CNode::theNodeMap.insert(nodemap_t::value_type(aNode, pNode)).second)
+
+ if ( pNode != 0 )
{
- // insertion done, register node with document
- xmlDocPtr doc = aNode->doc;
- if( doc != NULL)
- {
- CDocument* pDoc = static_cast< CDocument* >(CNode::get((xmlNodePtr)doc));
- pDoc->addnode(aNode);
- } else
+ if(!CNode::theNodeMap.insert(nodemap_t::value_type(aNode, pNode)).second)
{
// if insertion failed, delete the new instance and return null
delete pNode;