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:
parent
e33a94bff4
commit
de1f4885dd
@ -1941,8 +1941,8 @@ _cogl_material_prune_empty_layer_difference (CoglMaterial *layers_authority,
|
|||||||
if (layer_parent->index == layer->index && layer_parent->owner == NULL)
|
if (layer_parent->index == layer->index && layer_parent->owner == NULL)
|
||||||
{
|
{
|
||||||
cogl_handle_ref (layer_parent);
|
cogl_handle_ref (layer_parent);
|
||||||
cogl_handle_unref (layer);
|
|
||||||
link->data = layer->parent;
|
link->data = layer->parent;
|
||||||
|
cogl_handle_unref (layer);
|
||||||
recursively_free_layer_caches (layers_authority);
|
recursively_free_layer_caches (layers_authority);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user