From 66cb117056d71e694765e7e8e4c4098b48351106 Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Wed, 29 Apr 2009 19:49:09 +0100 Subject: [PATCH] [cogl-material] make _cogl_material_layer_free check for an invalid texture handle It is valid in some situations to have a material layer with an invalid texture handle (e.g. if you setup a texture combine mode before setting the texture) and so _cogl_material_layer_free needs to check for a valid handle before attempting to unref it. --- common/cogl-material.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/cogl-material.c b/common/cogl-material.c index 699ea0a10..2c7df33c8 100644 --- a/common/cogl-material.c +++ b/common/cogl-material.c @@ -644,7 +644,8 @@ cogl_material_set_layer_matrix (CoglHandle material_handle, static void _cogl_material_layer_free (CoglMaterialLayer *layer) { - cogl_handle_unref (layer->texture); + if (layer->texture != COGL_INVALID_HANDLE) + cogl_handle_unref (layer->texture); g_free (layer); }