[yelp/mallard] Putting links in Mallard cache and making sure cache isn't freed



commit 54fed8c7664f6a55a9bb30f96e4f743f1cb8f8fe
Author: Shaun McCance <shaunm gnome org>
Date:   Tue Jun 9 21:09:49 2009 -0500

    Putting links in Mallard cache and making sure cache isn't freed
---
 src/yelp-mallard.c   |    5 +++--
 src/yelp-transform.c |    5 +++--
 src/yelp-transform.h |    2 ++
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/yelp-mallard.c b/src/yelp-mallard.c
index 783b06d..087d832 100644
--- a/src/yelp-mallard.c
+++ b/src/yelp-mallard.c
@@ -519,7 +519,8 @@ mallard_page_data_info (MallardPageData *page_data,
                 xmlFree (role);
             }
         }
-        else if (xmlStrEqual (child->name, BAD_CAST "desc")) {
+        else if (xmlStrEqual (child->name, BAD_CAST "desc") ||
+                 xmlStrEqual (child->name, BAD_CAST "link")) {
             xmlAddChild (cache_node, xmlCopyNode (child, 1));
         }
     }
@@ -538,7 +539,7 @@ mallard_page_data_run (MallardPageData *page_data)
 
     params = g_new0 (gchar *, params_max);
     yelp_settings_params (&params, &params_i, &params_max);
-    params[params_i+1] = NULL;
+    params[params_i] = NULL;
 
     yelp_transform_set_input (page_data->transform,
                               page_data->mallard->priv->cache);
diff --git a/src/yelp-transform.c b/src/yelp-transform.c
index 38e7a88..01a42a5 100644
--- a/src/yelp-transform.c
+++ b/src/yelp-transform.c
@@ -239,6 +239,8 @@ transform_free (YelpTransform *transform)
     }
 
     g_mutex_lock (transform->mutex);
+    if (transform->input_xslt)
+	transform->input_xslt->doc = NULL;
     if (transform->outputDoc)
 	xmlFreeDoc (transform->outputDoc);
     if (transform->stylesheet)
@@ -450,7 +452,6 @@ xslt_yelp_cache (xsltTransformContextPtr ctxt,
 static void
 xslt_yelp_input (xmlXPathParserContextPtr ctxt, int nargs)
 {
-    xsltDocumentPtr idoc;
     xsltTransformContextPtr tctxt;
     xmlXPathObjectPtr ret;
     YelpTransform *transform;
@@ -459,7 +460,7 @@ xslt_yelp_input (xmlXPathParserContextPtr ctxt, int nargs)
     transform = (YelpTransform *) tctxt->_private;
 
     /* FIXME: pretty sure this eats transform->input, memory corruption will follow */
-    idoc = xsltNewDocument (tctxt, transform->input);
+    transform->input_xslt = xsltNewDocument (tctxt, transform->input);
 
     ret = xmlXPathNewNodeSet (xmlDocGetRootElement (transform->input));
     xsltExtensionInstructionResultRegister (tctxt, ret);
diff --git a/src/yelp-transform.h b/src/yelp-transform.h
index f5c30e0..131f866 100644
--- a/src/yelp-transform.h
+++ b/src/yelp-transform.h
@@ -48,7 +48,9 @@ struct _YelpTransform {
     xmlDocPtr               outputDoc;
     xsltStylesheetPtr       stylesheet;
     xsltTransformContextPtr context;
+
     xmlDocPtr               input;
+    xsltDocumentPtr         input_xslt;
 
     YelpTransformFunc       func;
 



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