From ee0bf5e26d73b47627f0655dd3c8a4c2377b3256 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Thu, 5 Feb 2009 18:26:08 +0000 Subject: [PATCH] [clutter-texture] Release the temporary ref taken when setting a texture When setting the cogl texture, the ClutterTexture takes a reference to the Cogl handle but the material takes an additional reference when it is set as the layer. Nothing was unrefing the temporary reference so the textures were being leaked. --- clutter/clutter-texture.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/clutter/clutter-texture.c b/clutter/clutter-texture.c index 413662127..c331b824e 100644 --- a/clutter/clutter-texture.c +++ b/clutter/clutter-texture.c @@ -1299,6 +1299,10 @@ clutter_texture_set_cogl_texture (ClutterTexture *texture, cogl_material_set_layer (priv->material, 0, cogl_tex); + /* The material now holds a reference to the texture so we can + safely release the reference we claimed above */ + cogl_texture_unref (cogl_tex); + size_change = width != priv->width || height != priv->height; priv->width = width; priv->height = height;