Re: [xml] Curious Segmentation Fault



On Mon, Apr 05, 2004 at 03:14:54AM -0400, Daniel Veillard wrote:
On Sun, Apr 04, 2004 at 11:33:05PM -0400, Anthony Carrico wrote:
Why?

  Because after element.unlinkNode(), the element still references
the document, and element.unlinkNode() checks it to find if the
strings from the element came from the document dictionary.
If you free the document after any element which references it you
don't have the problem. Allocation granularity in libxml2 is
at the document level.

So the third example (which seems to succed) is also illegal. Correct?
This one:

import libxml2
libxml2.debugMemory(1)
doc = libxml2.newDoc("1.0")
element = doc.newChild(None, "test", None)
element.unlinkNode()
doc.freeDoc()
doc = libxml2.newDoc("1.0")
doc.addChild(element)
element.unlinkNode()
element.freeNode()
doc.freeDoc()

-- 
Anthony Carrico



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