Simple - you create an element object in ruby, then add that element as the child of another element. The ruby element object still exists and still points at the same element though (and can be used to make changes to that element in the tree).
Is this avoidable by unsetting the Ruby object's free method when it is added to a node (and I suppose adding it back in if you remove it from the tree)? Then you'd only have the Ruby object pointing to the top level document having a free method (to free the libxml document).
To be really safe, you'd still want to go find all outstanding Ruby objects pointing to the freed libxml nodes and mark them as "invalid." Thus when a user tries to access one, they'd get an exception saying "the underlying libxml node has been freed" instead of segmentation fault. For what its worth, that's how I made SWIG work....
You can install callbacks, yes - that is what my patch does.
Ok, thanks. Sounds like your patch is the place to start. Charlie
smime.p7s
Description: S/MIME Cryptographic Signature
_______________________________________________ libxml-devel mailing list libxml-devel@rubyforge.org http://rubyforge.org/mailman/listinfo/libxml-devel