summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaun McCance <shaunm@gnome.org>2009-06-09 21:09:49 -0500
committerShaun McCance <shaunm@gnome.org>2009-06-09 21:09:49 -0500
commit54fed8c7664f6a55a9bb30f96e4f743f1cb8f8fe (patch)
treeeaac905d21eae5d55e3696e4c7b3e88f7e138bc2
parent2b4f4264f62827092f02e03d9f50bda29241fcf5 (diff)
downloadyelp-54fed8c7664f6a55a9bb30f96e4f743f1cb8f8fe.tar.gz
Putting links in Mallard cache and making sure cache isn't freed
-rw-r--r--src/yelp-mallard.c5
-rw-r--r--src/yelp-transform.c5
-rw-r--r--src/yelp-transform.h2
3 files changed, 8 insertions, 4 deletions
diff --git a/src/yelp-mallard.c b/src/yelp-mallard.c
index 783b06d6..087d8328 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 38e7a88d..01a42a54 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 f5c30e0b..131f866a 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;