[gtk+] css: Ensure proper type for parsing custom properties



commit 9551f542bdc10e1bdcd7f7561126476c9a68dd87
Author: Benjamin Otte <otte redhat com>
Date:   Sun Jan 15 02:29:00 2012 +0100

    css: Ensure proper type for parsing custom properties

 gtk/gtkcsscustomproperty.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkcsscustomproperty.c b/gtk/gtkcsscustomproperty.c
index fcb8a0f..b3949a8 100644
--- a/gtk/gtkcsscustomproperty.c
+++ b/gtk/gtkcsscustomproperty.c
@@ -38,13 +38,13 @@ gtk_css_custom_property_parse_value (GtkStyleProperty *property,
   GtkCssCustomProperty *custom = GTK_CSS_CUSTOM_PROPERTY (property);
   gboolean success;
 
-  g_value_init (value, _gtk_style_property_get_value_type (property));
-
   if (custom->property_parse_func)
     {
       GError *error = NULL;
       char *value_str;
       
+      g_value_init (value, _gtk_style_property_get_value_type (property));
+
       value_str = _gtk_css_parser_read_value (parser);
       if (value_str != NULL)
         {
@@ -55,7 +55,12 @@ gtk_css_custom_property_parse_value (GtkStyleProperty *property,
         success = FALSE;
     }
   else
-    success = _gtk_css_style_parse_value (value, parser, base);
+    {
+      GtkCssStyleProperty *style = GTK_CSS_STYLE_PROPERTY (property);
+      g_value_init (value, _gtk_css_style_property_get_specified_type (style));
+
+      success = _gtk_css_style_parse_value (value, parser, base);
+    }
 
   if (!success)
     g_value_unset (value);



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