Re: [xml] Memory reference after xmlFree in XPath evaluation



(oops, forgot to cc list)
On Fri 11:36,  4 April 2003, Daniel Veillard wrote:
On Fri, Apr 04, 2003 at 10:59:32AM +0100, Brian Stafford wrote:
> The problem arises when func() generates a node-set from scratch rather
than
> merely referencing nodes in the document being processed.  In this case the

> function will use code like

  First, what version are you using ? CVS ?

Current CVS.

  Second what function() generate that node set, where do the node
comes from ?

The function is part of a fairly complex program, unfortunately it's not easy to split out on its own to provide as a test case.

The function is responsible to provide the persistency
of that set of node.

> as is the case in some libexslt code.  During evaluation of the XPath
filter

  Which function creates nodes ?

I realised that so I used the implementation of the libexslt tokenize() function in libexslt/strings.c from the current libxslt CVS as an example of how to manage the persistency. My function creates a fake node and creates the nodeset in exactly the same way. I will try to write a simple test program that reproduces the problem - probably Monday before I have that ready.

The problem is the lifetime of the nodes.

Agreed

It's a VERY HARD problem indeed.

Agreed

Without precise examples it won't get anywhere. If your code creates
node to return them into node set, it better provide persistency for those.

Are you saying that the structure returned by xmlXPathNewNodeSet() is the wrong place to manage persistency of nodes created by XPath function implementations?


I will follow up with a test case ASAP

Brian Stafford



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]