From 5e5e8367ce3955fdc62ba47a8069f26db100552b Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Sat, 14 Jan 2012 05:00:54 +0100 Subject: [PATCH] css: Initialize value before calling compute function --- gtk/gtkcssstyleproperty.c | 3 ++- gtk/gtkcssstylepropertyimpl.c | 13 ++++--------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/gtk/gtkcssstyleproperty.c b/gtk/gtkcssstyleproperty.c index 9743b8821b..348ea0d163 100644 --- a/gtk/gtkcssstyleproperty.c +++ b/gtk/gtkcssstyleproperty.c @@ -287,7 +287,6 @@ gtk_css_style_property_real_compute_value (GtkCssStyleProperty *property, GtkStyleContext *context, const GValue *specified) { - g_value_init (computed, _gtk_style_property_get_value_type (GTK_STYLE_PROPERTY (property))); _gtk_css_style_compute_value (computed, context, specified); } @@ -465,6 +464,8 @@ _gtk_css_style_property_compute_value (GtkCssStyleProperty *property, g_return_if_fail (GTK_IS_STYLE_CONTEXT (context)); g_return_if_fail (G_IS_VALUE (specified)); + g_value_init (computed, _gtk_css_style_property_get_computed_type (property)); + property->compute_value (property, computed, context, specified); } diff --git a/gtk/gtkcssstylepropertyimpl.c b/gtk/gtkcssstylepropertyimpl.c index d41048f328..66e1df5e38 100644 --- a/gtk/gtkcssstylepropertyimpl.c +++ b/gtk/gtkcssstylepropertyimpl.c @@ -52,11 +52,6 @@ color_compute (GtkCssStyleProperty *property, GtkStyleContext *context, const GValue *specified) { - g_value_init (computed, GDK_TYPE_RGBA); - - /* for when resolvage fails */ -restart: - if (G_VALUE_HOLDS (specified, GTK_TYPE_SYMBOLIC_COLOR)) { GtkSymbolicColor *symbolic = g_value_get_boxed (specified); @@ -92,8 +87,10 @@ restart: } else { - specified = _gtk_css_style_property_get_initial_value (property); - goto restart; + color_compute (property, + computed, + context, + _gtk_css_style_property_get_initial_value (property)); } } @@ -446,7 +443,6 @@ css_image_value_compute (GtkCssStyleProperty *property, if (image) image = _gtk_css_image_compute (image, context); - g_value_init (computed, GTK_TYPE_CSS_IMAGE); g_value_take_object (computed, image); } @@ -465,7 +461,6 @@ compute_border_width (GtkCssStyleProperty *property, style = _gtk_css_style_property_lookup_by_id (_gtk_css_style_property_get_id (property) - 1); border_style = g_value_get_enum (_gtk_style_context_peek_property (context, _gtk_style_property_get_name (GTK_STYLE_PROPERTY (style)))); - g_value_init (computed, G_TYPE_INT); if (border_style == GTK_BORDER_STYLE_NONE || border_style == GTK_BORDER_STYLE_HIDDEN) g_value_set_int (computed, 0);