css: Ensure proper type for parsing custom properties

This commit is contained in:
Benjamin Otte
2012-01-15 02:29:00 +01:00
parent 893807bee0
commit 9551f542bd

View File

@ -38,13 +38,13 @@ gtk_css_custom_property_parse_value (GtkStyleProperty *property,
GtkCssCustomProperty *custom = GTK_CSS_CUSTOM_PROPERTY (property); GtkCssCustomProperty *custom = GTK_CSS_CUSTOM_PROPERTY (property);
gboolean success; gboolean success;
g_value_init (value, _gtk_style_property_get_value_type (property));
if (custom->property_parse_func) if (custom->property_parse_func)
{ {
GError *error = NULL; GError *error = NULL;
char *value_str; char *value_str;
g_value_init (value, _gtk_style_property_get_value_type (property));
value_str = _gtk_css_parser_read_value (parser); value_str = _gtk_css_parser_read_value (parser);
if (value_str != NULL) if (value_str != NULL)
{ {
@ -55,7 +55,12 @@ gtk_css_custom_property_parse_value (GtkStyleProperty *property,
success = FALSE; success = FALSE;
} }
else 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) if (!success)
g_value_unset (value); g_value_unset (value);