summaryrefslogtreecommitdiff
path: root/unoxml
diff options
context:
space:
mode:
authorMichael Stahl <mst@openoffice.org>2011-01-19 20:27:16 +0100
committerMichael Stahl <mst@openoffice.org>2011-01-19 20:27:16 +0100
commitcb5905f108fb7bb99587791fca24c9d481ae93d9 (patch)
tree3340bbf8e61f49c137e383c4f1e84f92f7efa0e4 /unoxml
parentc33c26cbd26310ed03aadfb6fa361f10febb56d5 (diff)
xmlfix3: unoxml: new method CNode::invalidate
Diffstat (limited to 'unoxml')
-rw-r--r--unoxml/source/dom/element.cxx2
-rw-r--r--unoxml/source/dom/node.cxx15
-rw-r--r--unoxml/source/dom/node.hxx1
3 files changed, 12 insertions, 6 deletions
diff --git a/unoxml/source/dom/element.cxx b/unoxml/source/dom/element.cxx
index e0e27d9b5007..8006a4f5ef41 100644
--- a/unoxml/source/dom/element.cxx
+++ b/unoxml/source/dom/element.cxx
@@ -422,7 +422,7 @@ namespace DOM
aAttr->setValue(oldAttr->getValue());
xmlRemoveProp(pAttr);
::rtl::Reference<CNode> const pCNode( CNode::getCNode(pNode) );
- pCNode->m_aNodePtr = NULL; // freed by xmlRemoveProp
+ pCNode->invalidate(); // freed by xmlRemoveProp
}
return aAttr;
}
diff --git a/unoxml/source/dom/node.cxx b/unoxml/source/dom/node.cxx
index 58c6a96b51db..f122b62dd9e2 100644
--- a/unoxml/source/dom/node.cxx
+++ b/unoxml/source/dom/node.cxx
@@ -293,7 +293,7 @@ namespace DOM
m_rDocument = getOwnerDocument();
}
- CNode::~CNode()
+ void CNode::invalidate()
{
//remove from list if this wrapper goes away
if (m_aNodePtr != 0) {
@@ -303,6 +303,12 @@ namespace DOM
if (m_bUnlinked) {
xmlFreeNode(m_aNodePtr);
}
+ m_aNodePtr = 0;
+ }
+
+ CNode::~CNode()
+ {
+ invalidate();
}
static void _nsexchange(const xmlNodePtr aNode, xmlNsPtr oldNs, xmlNsPtr newNs)
@@ -469,8 +475,7 @@ namespace DOM
::rtl::Reference<CNode> pCNode(CNode::getCNode(cur));
OSL_ASSERT(pCNode.is());
if (pCNode.is()) {
- pCNode->m_aNodePtr = 0; // has been freed
- CNode::removeCNode(cur, pCNode.get());
+ pCNode->invalidate(); // cur has been freed
}
}
@@ -852,7 +857,7 @@ namespace DOM
{
xmlAttrPtr pAttr = (xmlAttrPtr) old;
xmlRemoveProp( pAttr );
- pOld->m_aNodePtr = NULL; // freed by xmlRemoveProp
+ pOld->invalidate(); // freed by xmlRemoveProp
xReturn.clear();
}
else
@@ -924,7 +929,7 @@ namespace DOM
xmlAttrPtr pAttr = (xmlAttrPtr)pOld;
xmlRemoveProp( pAttr );
::rtl::Reference<CNode> const pOldNode( CNode::getCNode(pOld) );
- pOldNode->m_aNodePtr = NULL; // freed by xmlRemoveProp
+ pOldNode->invalidate(); // freed by xmlRemoveProp
appendChild( newChild );
}
else
diff --git a/unoxml/source/dom/node.hxx b/unoxml/source/dom/node.hxx
index 9dc5d65347a2..b61788649a37 100644
--- a/unoxml/source/dom/node.hxx
+++ b/unoxml/source/dom/node.hxx
@@ -135,6 +135,7 @@ namespace DOM
// for initialization by classes derived through ImplInheritanceHelper
CNode();
void init_node(const xmlNodePtr aNode);
+ void invalidate();
void dispatchSubtreeModified();