[seed] XPathContext objects should keep their respective XMLDocument object alive



commit f74c53673542ebb8fdf0f803cfc3a241d2c28e63
Author: Robert Carr <racarr svn gnome org>
Date:   Tue May 12 13:02:24 2009 -0400

    XPathContext objects should keep their respective XMLDocument object alive
---
 modules/libxml/libxml.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/modules/libxml/libxml.c b/modules/libxml/libxml.c
index 94e37e2..47c44a7 100644
--- a/modules/libxml/libxml.c
+++ b/modules/libxml/libxml.c
@@ -304,6 +304,8 @@ seed_xml_construct_xpath_context (SeedContext ctx,
   doc = XML_DOC_PRIV (this_object);
   xpath = xmlXPathNewContext (doc);
   
+  seed_value_protect (ctx, this_object);
+  
   return seed_make_object (ctx, xml_xpath_class, xpath);
 }
 
@@ -311,6 +313,8 @@ static void
 seed_xml_xpath_finalize (SeedObject object)
 {
   xmlXPathContextPtr xpath = XML_XPATH_PRIV (object);
+  // Maybe unsafe. Seems to work.
+  seed_value_unprotect (eng->context, xpath->doc->_private);
   xmlXPathFreeContext (xpath);
 }
 



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