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.
This commit is contained in:
Neil Roberts 2010-08-06 16:41:41 +01:00
parent 7032e24950
commit fcbfd4ec34

View File

@ -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,