diff options
author | Michael Stahl <mst@openoffice.org> | 2011-01-11 13:02:25 +0100 |
---|---|---|
committer | Michael Stahl <mst@openoffice.org> | 2011-01-11 13:02:25 +0100 |
commit | 737a43c324706fa6d20302465191fe756a77f003 (patch) | |
tree | ad5be555164959b8db68969bb7031d1ac46d7334 /unoxml | |
parent | 220821e1f4c3cb86a891e5864b665cadcfaed0c6 (diff) |
xmlfix3: #i115995#: unoxml: retain context node in XPath::CNodeList:
prevents the document containing the nodes from being released.
Diffstat (limited to 'unoxml')
-rw-r--r-- | unoxml/source/xpath/nodelist.cxx | 7 | ||||
-rw-r--r-- | unoxml/source/xpath/nodelist.hxx | 6 | ||||
-rw-r--r-- | unoxml/source/xpath/xpathobject.cxx | 4 |
3 files changed, 13 insertions, 4 deletions
diff --git a/unoxml/source/xpath/nodelist.cxx b/unoxml/source/xpath/nodelist.cxx index dd44d8bfcc06..0c18a65ab0e9 100644 --- a/unoxml/source/xpath/nodelist.cxx +++ b/unoxml/source/xpath/nodelist.cxx @@ -30,8 +30,11 @@ namespace XPath { - CNodeList::CNodeList(boost::shared_ptr<xmlXPathObject>& rxpathObj) - : m_pNodeSet(0) + CNodeList::CNodeList( + Reference<XNode> const& xContextNode, + boost::shared_ptr<xmlXPathObject>& rxpathObj) + : m_xContextNode(xContextNode) + , m_pNodeSet(0) { if (rxpathObj != NULL && rxpathObj->type == XPATH_NODESET) { diff --git a/unoxml/source/xpath/nodelist.hxx b/unoxml/source/xpath/nodelist.hxx index 68f419f10174..38e40e5113af 100644 --- a/unoxml/source/xpath/nodelist.hxx +++ b/unoxml/source/xpath/nodelist.hxx @@ -52,11 +52,15 @@ namespace XPath class CNodeList : public cppu::WeakImplHelper1< XNodeList > { private: + /// #i115995# retain context node to keep document alive + const Reference< XNode > m_xContextNode; boost::shared_ptr<xmlXPathObject> m_pXPathObj; xmlNodeSetPtr m_pNodeSet; public: - CNodeList(boost::shared_ptr<xmlXPathObject> &rxpathObj); + CNodeList( + Reference<XNode> const& xContextNode, + boost::shared_ptr<xmlXPathObject> &rxpathObj); /** The number of nodes in the list. */ diff --git a/unoxml/source/xpath/xpathobject.cxx b/unoxml/source/xpath/xpathobject.cxx index 757de0c5aac4..a02c79b9945b 100644 --- a/unoxml/source/xpath/xpathobject.cxx +++ b/unoxml/source/xpath/xpathobject.cxx @@ -85,7 +85,9 @@ namespace XPath */ Reference< XNodeList > SAL_CALL CXPathObject::getNodeList() throw (RuntimeException) { - return Reference< XNodeList >(new CNodeList(m_pXPathObj)); + Reference< XNodeList > const xRet( + new CNodeList(m_xContextNode, m_pXPathObj)); + return xRet; } /** |