Commit a78e2808 authored by Dominic Lachowicz's avatar Dominic Lachowicz Committed by Dom Lachowicz

gdmgreeter segfault due to libxml2 API/ABI change (#549087). Patch by Tom

2008-10-20  Dominic Lachowicz <domlachowicz@gmail.com>

        * rsvg-gobject.c: gdmgreeter segfault due to libxml2 API/ABI change
        (#549087). Patch by Tom Parker (palfrey%40tevp.net). Untested against
        libxml2 >= 2.7.0, but DV says "from the distance, that patch seems
        to do the right thing"
        * rsvg-base.c: ditto


svn path=/trunk/; revision=1182
parent 698d3be2
2008-10-20 Dominic Lachowicz <domlachowicz@gmail.com>
* rsvg-gobject.c: gdmgreeter segfault due to libxml2 API/ABI change
(#549087). Patch by Tom Parker (palfrey%40tevp.net). Untested against
libxml2 >= 2.7.0, but DV says "from the distance, that patch seems
to do the right thing"
* rsvg-base.c: ditto
2008-10-20 Dominic Lachowicz <domlachowicz@gmail.com>
* rsvg-convert.c: background color setting feature in rsvg_convert program
......
......@@ -43,6 +43,8 @@
#include "rsvg-mask.h"
#include "rsvg-marker.h"
#include <libxml/uri.h>
#include <math.h>
#include <string.h>
#include <stdarg.h>
......@@ -796,6 +798,21 @@ rsvg_entity_decl (void *data, const xmlChar * name, int type,
RsvgHandle *ctx = (RsvgHandle *) data;
GHashTable *entities = ctx->priv->entities;
xmlEntityPtr entity;
#if LIBXML_VERSION >= 20700
xmlChar *resolvedSystemId = NULL, *resolvedPublicId = NULL;
if (systemId)
resolvedSystemId = xmlBuildRelativeURI (systemId, (xmlChar*) rsvg_handle_get_base_uri (ctx));
else if (publicId)
resolvedPublicId = xmlBuildRelativeURI (publicId, (xmlChar*) rsvg_handle_get_base_uri (ctx));
entity = xmlNewEntity(NULL, name, type, resolvedPublicId, resolvedSystemId, content);
free(resolvedPublicId);
free(resolvedSystemId);
g_hash_table_insert (entities, g_strdup ((const char*) name), entity);
#else
xmlChar *dupname;
entity = xmlMalloc (sizeof (xmlEntity));
......@@ -834,6 +851,7 @@ rsvg_entity_decl (void *data, const xmlChar * name, int type,
}
g_hash_table_insert (entities, dupname, entity);
#endif
}
static void
......
......@@ -70,6 +70,7 @@ rsvg_ctx_free_helper (gpointer key, gpointer value, gpointer user_data)
{
xmlEntityPtr entval = (xmlEntityPtr) value;
#if LIBXML_VERSION < 20700
/* key == entval->name, so it's implicitly freed below */
xmlFree ((xmlChar *) entval->name);
......@@ -78,6 +79,9 @@ rsvg_ctx_free_helper (gpointer key, gpointer value, gpointer user_data)
xmlFree (entval->content);
xmlFree (entval->orig);
xmlFree (entval);
#else
xmlFreeNode(entval);
#endif
}
static void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment