From 283dce8e21b58bd769e923e9239d5607b820ddd9 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Mon, 6 Sep 2010 18:07:07 +0100 Subject: [PATCH] material: Check before unreferencing a texture When disposing a material layer of type 'texture' we should check that the texture handle is still valid before calling cogl_handle_unref(). This avoids an assertion failure when disposing a ClutterTexture. --- clutter/cogl/cogl/cogl-material.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clutter/cogl/cogl/cogl-material.c b/clutter/cogl/cogl/cogl-material.c index b21f4311b..f4936bf43 100644 --- a/clutter/cogl/cogl/cogl-material.c +++ b/clutter/cogl/cogl/cogl-material.c @@ -4457,7 +4457,8 @@ _cogl_material_layer_free (CoglMaterialLayer *layer) } } - if (layer->differences & COGL_MATERIAL_LAYER_STATE_TEXTURE) + if (layer->differences & COGL_MATERIAL_LAYER_STATE_TEXTURE && + layer->texture != COGL_INVALID_HANDLE) cogl_handle_unref (layer->texture); if (layer->differences & COGL_MATERIAL_LAYER_STATE_NEEDS_BIG_STATE)