material: Avoid possibly reading invalid memory

in _cogl_material_prune_empty_layer_difference we sometimes unref the
given layer before dereferencing it to get a pointer to its parent. This
defers the unref until after we have fetched the parent pointer.
This commit is contained in:
Robert Bragg 2010-06-23 17:10:03 +01:00
parent e33a94bff4
commit de1f4885dd

View File

@ -1941,8 +1941,8 @@ _cogl_material_prune_empty_layer_difference (CoglMaterial *layers_authority,
if (layer_parent->index == layer->index && layer_parent->owner == NULL)
{
cogl_handle_ref (layer_parent);
cogl_handle_unref (layer);
link->data = layer->parent;
cogl_handle_unref (layer);
recursively_free_layer_caches (layers_authority);
return;
}