attribute: Only unref buffer for buffered attributes

constant attributes don't have a corresponding buffer so
_cogl_attribute_free shouldn't try to unref it. Also, for good measure,
in the case of constant attributes we should call
_cogl_boxed_value_destroy() (although currently we know there is no
dynamic data associated with the boxed values).

(cherry picked from commit 89d6dc90d10c59676e0deed87c2c15a0c9712737)
This commit is contained in:
Robert Bragg 2012-09-28 17:58:31 +01:00
parent 6e379fb54e
commit 63db64f426

View File

@ -534,7 +534,10 @@ _cogl_attribute_immutable_unref (CoglAttribute *attribute)
static void
_cogl_attribute_free (CoglAttribute *attribute)
{
cogl_object_unref (attribute->d.buffered.attribute_buffer);
if (attribute->is_buffered)
cogl_object_unref (attribute->d.buffered.attribute_buffer);
else
_cogl_boxed_value_destroy (&attribute->d.constant.boxed);
g_slice_free (CoglAttribute, attribute);
}