[gtk+] shorthand: Only unset values that are set



commit 50c5bf97ea24da275a3398e2be549f4a2d2af693
Author: Benjamin Otte <otte redhat com>
Date:   Tue Jan 31 03:59:32 2012 +0100

    shorthand: Only unset values that are set
    
    Otherwise g_value_unset() complains. And that breaks the testsuite.

 gtk/gtkcssshorthandproperty.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkcssshorthandproperty.c b/gtk/gtkcssshorthandproperty.c
index c74ddae..0dcfff0 100644
--- a/gtk/gtkcssshorthandproperty.c
+++ b/gtk/gtkcssshorthandproperty.c
@@ -84,6 +84,13 @@ _gtk_css_shorthand_property_query (GtkStyleProperty   *property,
   shorthand->query (shorthand, value, query_func, query_data);
 }
 
+static void
+gtk_css_shorthand_property_unset_value (gpointer value)
+{
+  if (G_IS_VALUE (value))
+    g_value_unset (value);
+}
+
 static gboolean
 gtk_css_shorthand_property_parse_value (GtkStyleProperty *property,
                                         GValue           *value,
@@ -95,7 +102,7 @@ gtk_css_shorthand_property_parse_value (GtkStyleProperty *property,
   guint i;
 
   array = g_array_new (FALSE, TRUE, sizeof (GValue));
-  g_array_set_clear_func (array, (GDestroyNotify) g_value_unset);
+  g_array_set_clear_func (array, gtk_css_shorthand_property_unset_value);
   g_array_set_size (array, shorthand->subproperties->len);
 
   if (_gtk_css_parser_try (parser, "initial", TRUE))



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