Re: [PATCH 18/41] drm/intel: destructor for glyph cache node

Uli Schlachter <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
Am 10.12.2015 um 23:16 schrieb Enrico Weigelt, metux IT consult:
> Signed-off-by: Enrico Weigelt, metux IT consult <[email protected]>
> ---
>  src/drm/cairo-drm-intel.c | 23 ++++++++++++++++++++++-
>  1 file changed, 22 insertions(+), 1 deletion(-)
> 
> diff --git a/src/drm/cairo-drm-intel.c b/src/drm/cairo-drm-intel.c
> index f250bb6..1abcd20 100644
> --- a/src/drm/cairo-drm-intel.c
> +++ b/src/drm/cairo-drm-intel.c
> @@ -967,6 +967,24 @@ intel_glyph_cache_add_glyph (intel_device_t *device,
>      return CAIRO_INT_STATUS_SUCCESS;
>  }
>  
> +static void
> +_cairo_drm_intel_node_destroy (cairo_rtree_node_t *node)
> +{
> +    intel_glyph_t *priv = cairo_container_of (node, intel_glyph_t, node);
> +    cairo_scaled_glyph_t *glyph;
> +
> +    glyph = priv->glyph;
> +    if (glyph == NULL)
> +	return;
> +
> +    if (glyph->dev_private_key == priv->cache) {
> +	glyph->dev_private = NULL;
> +	glyph->dev_private_key = NULL;
> +    }
> +    cairo_list_del (&priv->base.link);
> +    priv->glyph = NULL;
> +}
> +
>  void
>  intel_scaled_glyph_fini (cairo_scaled_glyph_private_t *scaled_glyph_private,
>  			 cairo_scaled_glyph_t         *scaled_glyph,
> @@ -976,6 +994,8 @@ intel_scaled_glyph_fini (cairo_scaled_glyph_private_t *scaled_glyph_private,
>  					     intel_glyph_t,
>  					     base);
>  
> +    _cairo_drm_intel_node_destroy (&priv->node);
> +
>      /* XXX thread-safety? Probably ok due to the frozen scaled-font. */
>      if (! priv->node.pinned)
>  	_cairo_rtree_node_remove (&priv->cache->rtree, &priv->node);
> @@ -1024,7 +1044,8 @@ intel_get_glyph_cache (intel_device_t *device,
>  			   GLYPH_CACHE_WIDTH,
>  			   GLYPH_CACHE_HEIGHT,
>  			   GLYPH_CACHE_MIN_SIZE,
> -			   sizeof (intel_glyph_t));
> +			   sizeof (intel_glyph_t),
> +			   _cairo_drm_intel_node_destroy);
>      }

Uhm, where does this leak come from? That seems like a weird bug to have.

Is this "fallout" from some earlier patch? If yes, shouldn't this be part of
that patch?
-- 
"Are you preparing for another war, Plutarch?" I ask.
"Oh, not now. Now we're in that sweet period where everyone agrees that our
recent horrors should never be repeated," he says. "But collective thinking is
usually short-lived. We're fickle, stupid beings with poor memories and a great
gift for self-destruction.
-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.