Commit 67290427 authored by Federico Mena Quintero's avatar Federico Mena Quintero

Merge branch 'tree-leak' into 'master'

Tree leak

See merge request GNOME/librsvg!114
parents 4ac653e8 92984bbe
......@@ -55,9 +55,9 @@ several systems.
### Debian based systems
As of 2018/Feb/22, librsvg cannot be built in `debian stable` and
`ubuntu 16.04`, as they have packages that are too old.
`ubuntu 18.04`, as they have packages that are too old.
**Build dependencies on Debian Testing or Ubuntu 18.04+:**
**Build dependencies on Debian Testing or Ubuntu 18.10:**
```sh
apt-get install -y gcc make rustc cargo \
......
......@@ -1166,9 +1166,11 @@ get_node_ink_rect(RsvgHandle *handle, RsvgNode *node, cairo_rectangle_t *ink_rec
gboolean
rsvg_handle_get_dimensions_sub (RsvgHandle * handle, RsvgDimensionData * dimension_data, const char *id)
{
RsvgNode *root = NULL;
RsvgNode *node;
gboolean has_size;
int root_width, root_height;
gboolean res = FALSE;
g_return_val_if_fail (handle, FALSE);
g_return_val_if_fail (dimension_data, FALSE);
......@@ -1178,27 +1180,31 @@ rsvg_handle_get_dimensions_sub (RsvgHandle * handle, RsvgDimensionData * dimensi
if (handle->priv->tree == NULL)
return FALSE;
root = rsvg_tree_get_root (handle->priv->tree);
if (id && *id) {
node = rsvg_defs_lookup (handle->priv->defs, id);
if (rsvg_tree_is_root (handle->priv->tree, node))
id = NULL;
} else {
node = rsvg_tree_get_root (handle->priv->tree);
node = root;
}
if (!node && id)
return FALSE;
if (!node && id) {
goto out;
}
has_size = rsvg_node_svg_get_size (rsvg_tree_get_root (handle->priv->tree),
has_size = rsvg_node_svg_get_size (root,
handle->priv->dpi_x, handle->priv->dpi_y,
&root_width, &root_height);
if (id || !has_size) {
cairo_rectangle_t ink_rect;
if (!get_node_ink_rect (handle, node, &ink_rect))
return FALSE;
if (!get_node_ink_rect (handle, node, &ink_rect)) {
goto out;
}
dimension_data->width = ink_rect.width;
dimension_data->height = ink_rect.height;
......@@ -1214,7 +1220,13 @@ rsvg_handle_get_dimensions_sub (RsvgHandle * handle, RsvgDimensionData * dimensi
(*handle->priv->size_func) (&dimension_data->width, &dimension_data->height,
handle->priv->user_data);
return TRUE;
res = TRUE;
out:
g_clear_pointer (&root, rsvg_node_unref);
return res;
}
/**
......
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