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.
This commit is contained in:
Emmanuele Bassi 2010-09-06 18:07:07 +01:00
parent b4120b81e4
commit 283dce8e21

View File

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