Kaydet (Commit) 1b7ab32b authored tarafından Caolán McNamara's avatar Caolán McNamara Kaydeden (comit) David Tardon

Resolves: fdo#33701 ensure node outlives path

The xpath on destruction needs the xmldoc to exist, so the reference
to the doc-owning nodelist needs to be the first reference listed
in the class in order that its dtor is called *after* the xpath
dtor
Signed-off-by: 's avatarDavid Tardon <dtardon@redhat.com>
üst cc949104
......@@ -31,8 +31,8 @@
namespace XPath
{
CNodeList::CNodeList(boost::shared_ptr<xmlXPathObject>& rxpathObj, const Reference< XNode >& contextNode)
: m_xContextNode(contextNode)
CNodeList::CNodeList(const Reference< XNode >& rContextNode, boost::shared_ptr<xmlXPathObject>& rxpathObj)
: m_xContextNode(rContextNode)
, m_pNodeSet(0)
{
if (rxpathObj != NULL && rxpathObj->type == XPATH_NODESET)
......
......@@ -53,12 +53,12 @@ namespace XPath
class CNodeList : public cppu::WeakImplHelper1< XNodeList >
{
private:
boost::shared_ptr<xmlXPathObject> m_pXPathObj;
const Reference< XNode > m_xContextNode;
boost::shared_ptr<xmlXPathObject> m_pXPathObj;
xmlNodeSetPtr m_pNodeSet;
public:
CNodeList(boost::shared_ptr<xmlXPathObject> &rxpathObj, const Reference< XNode >& contextNode);
CNodeList(const Reference< XNode >& contextNode, boost::shared_ptr<xmlXPathObject> &rxpathObj);
/**
The number of nodes in the list.
*/
......
......@@ -86,7 +86,7 @@ namespace XPath
*/
Reference< XNodeList > SAL_CALL CXPathObject::getNodeList() throw (RuntimeException)
{
return Reference< XNodeList >(new CNodeList(m_pXPathObj, m_xContextNode));
return Reference< XNodeList >(new CNodeList(m_xContextNode, m_pXPathObj));
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment