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

Uli Schlachter psychon at znc.in
Fri Dec 11 08:53:33 PST 2015


Am 10.12.2015 um 23:16 schrieb Enrico Weigelt, metux IT consult:
> Signed-off-by: Enrico Weigelt, metux IT consult <enrico.weigelt at gr13.net>
> ---
>  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.


More information about the cairo mailing list