summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Bragg <robert@linux.intel.com>2012-09-28 17:58:31 +0100
committerRobert Bragg <robert@linux.intel.com>2012-09-28 17:58:31 +0100
commit89d6dc90d10c59676e0deed87c2c15a0c9712737 (patch)
tree6e4919b7913f89978e923cb67170d8a5eb49d4b7
parent6507216f8030e84dcf2e63b8ecfe906ac47f2ca7 (diff)
downloadcogl-89d6dc90d10c59676e0deed87c2c15a0c9712737.tar.gz
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).
-rw-r--r--cogl/cogl-attribute.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/cogl/cogl-attribute.c b/cogl/cogl-attribute.c
index ec5ed955..09291709 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);
}