From fcbfd4ec34ba53953935954cf90f09e5675fb8cc Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Fri, 6 Aug 2010 16:41:41 +0100 Subject: [PATCH] cogl-material: Unref the texture when reverting authority When the texture is set on a layer so that it is back to the parent's texture it would clear the texture change flag but it wouldn't unref the texture. The free function for a material layer does not unref the texture if the change flag is cleared so the texture would end up leaking. This happens for ClutterTexture because it disposes the texture by setting layer 0 of the material to COGL_INVALID_HANDLE which ends up the same as the default material. --- clutter/cogl/cogl/cogl-material.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/clutter/cogl/cogl/cogl-material.c b/clutter/cogl/cogl/cogl-material.c index 40bbd7ece..8abb9ef48 100644 --- a/clutter/cogl/cogl/cogl-material.c +++ b/clutter/cogl/cogl/cogl-material.c @@ -1900,6 +1900,9 @@ _cogl_material_set_layer_texture (CoglMaterial *material, { layer->differences &= ~change; + if (layer->texture != COGL_INVALID_HANDLE) + cogl_handle_unref (layer->texture); + g_assert (layer->owner == material); if (layer->differences == 0) _cogl_material_prune_empty_layer_difference (material,