summaryrefslogtreecommitdiff
path: root/libyelp/yelp-transform.c
diff options
context:
space:
mode:
authorShaun McCance <shaunm@gnome.org>2009-11-15 16:36:27 -0600
committerShaun McCance <shaunm@gnome.org>2009-11-15 16:36:27 -0600
commit2311a1568af07235722302f9a1936a8b05699cf4 (patch)
tree098e2bb275f46a60e236b7b112100a22c38fbc7b /libyelp/yelp-transform.c
parent63016128972c806708cd458c4bf4331da42a9423 (diff)
downloadyelp-2311a1568af07235722302f9a1936a8b05699cf4.tar.gz
[yelp-docbook-document] Adding DocBook support into libyelp
Diffstat (limited to 'libyelp/yelp-transform.c')
-rw-r--r--libyelp/yelp-transform.c52
1 files changed, 33 insertions, 19 deletions
diff --git a/libyelp/yelp-transform.c b/libyelp/yelp-transform.c
index 1d02338a..eecfe6a7 100644
--- a/libyelp/yelp-transform.c
+++ b/libyelp/yelp-transform.c
@@ -145,11 +145,11 @@ yelp_transform_class_init (YelpTransformClass *klass)
object_class->set_property = yelp_transform_set_property;
signals[CHUNK_READY] = g_signal_new ("chunk-ready",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0, NULL, NULL,
- g_cclosure_marshal_VOID__STRING,
- G_TYPE_NONE, 1, G_TYPE_STRING);
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0, NULL, NULL,
+ g_cclosure_marshal_VOID__STRING,
+ G_TYPE_NONE, 1, G_TYPE_STRING);
signals[FINISHED] = g_signal_new ("finished",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
@@ -181,6 +181,8 @@ yelp_transform_dispose (GObject *object)
{
YelpTransformPrivate *priv = GET_PRIV (object);
+ debug_print (DB_FUNCTION, "entering\n");
+
if (priv->queue) {
gchar *chunk_id;
while ((chunk_id = (gchar *) g_async_queue_try_pop (priv->queue)))
@@ -189,6 +191,32 @@ yelp_transform_dispose (GObject *object)
priv->queue = NULL;
}
+ /* We do not free input or aux. They belong to the caller, which
+ must ensure they exist for the lifetime of the transform. We
+ have to set priv->aux_xslt->doc (which is priv->aux) to NULL
+ before xsltFreeTransformContext. Otherwise it will be freed,
+ which we don't want.
+ */
+ if (priv->aux_xslt)
+ priv->aux_xslt->doc = NULL;
+
+ /* We free these in dispose to make absolutely certain that they're
+ freed by the time any weak notify callbacks are called. These
+ may be used elsewhere to free resources like the input document.
+ */
+ if (priv->context) {
+ xsltFreeTransformContext (priv->context);
+ priv->context = NULL;
+ }
+ if (priv->stylesheet) {
+ xsltFreeStylesheet (priv->stylesheet);
+ priv->stylesheet = NULL;
+ }
+ if (priv->output) {
+ xmlFreeDoc (priv->output);
+ priv->output = NULL;
+ }
+
G_OBJECT_CLASS (yelp_transform_parent_class)->dispose (object);
}
@@ -202,20 +230,6 @@ yelp_transform_finalize (GObject *object)
debug_print (DB_FUNCTION, "entering\n");
- if (priv->output)
- xmlFreeDoc (priv->output);
- if (priv->stylesheet)
- xsltFreeStylesheet (priv->stylesheet);
- /* We do not free input or aux. They belong to the caller, which
- must ensure they exist for the lifetime of the transform. We
- have to set priv->aux_xslt->doc (which is priv->aux) to NULL
- before xsltFreeTransformContext. Otherwise it will be freed,
- which we don't want.
- */
- if (priv->aux_xslt)
- priv->aux_xslt->doc = NULL;
- if (priv->context)
- xsltFreeTransformContext (priv->context);
if (priv->error)
g_error_free (priv->error);