From 63db64f4265138feda9c04967947c8f10792e83a Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Fri, 28 Sep 2012 17:58:31 +0100 Subject: [PATCH] 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) --- cogl/cogl-attribute.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cogl/cogl-attribute.c b/cogl/cogl-attribute.c index 81a75782c..8b7f3d552 100644 --- a/cogl/cogl-attribute.c +++ b/cogl/cogl-attribute.c @@ -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); }