[cogl/cogl-1.14: 76/174] attribute: Only unref buffer for buffered attributes



commit 63db64f4265138feda9c04967947c8f10792e83a
Author: Robert Bragg <robert linux intel com>
Date:   Fri Sep 28 17:58:31 2012 +0100

    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 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/cogl/cogl-attribute.c b/cogl/cogl-attribute.c
index 81a7578..8b7f3d5 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);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]