mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 10:50:10 +00:00
Fix color style properties lookup when the color resolution fails
The cached GValue ended up with a GtkSymbolicColor type, so the contained value was bogus. Noticed by Mitch.
This commit is contained in:
parent
23f9bdd586
commit
2be692687f
@ -2343,17 +2343,19 @@ _gtk_style_context_peek_style_property (GtkStyleContext *context,
|
||||
GtkSymbolicColor *color;
|
||||
GdkRGBA rgba;
|
||||
|
||||
color = g_value_get_boxed (&pcache->value);
|
||||
color = g_value_dup_boxed (&pcache->value);
|
||||
|
||||
g_value_unset (&pcache->value);
|
||||
|
||||
if (G_PARAM_SPEC_VALUE_TYPE (pspec) == GDK_TYPE_RGBA)
|
||||
g_value_init (&pcache->value, GDK_TYPE_RGBA);
|
||||
else
|
||||
g_value_init (&pcache->value, GDK_TYPE_COLOR);
|
||||
|
||||
if (gtk_symbolic_color_resolve (color, data->store, &rgba))
|
||||
{
|
||||
g_value_unset (&pcache->value);
|
||||
|
||||
if (G_PARAM_SPEC_VALUE_TYPE (pspec) == GDK_TYPE_RGBA)
|
||||
{
|
||||
g_value_init (&pcache->value, GDK_TYPE_RGBA);
|
||||
g_value_set_boxed (&pcache->value, &rgba);
|
||||
}
|
||||
g_value_set_boxed (&pcache->value, &rgba);
|
||||
else
|
||||
{
|
||||
GdkColor rgb;
|
||||
@ -2362,12 +2364,13 @@ _gtk_style_context_peek_style_property (GtkStyleContext *context,
|
||||
rgb.green = rgba.green * 65535. + 0.5;
|
||||
rgb.blue = rgba.blue * 65535. + 0.5;
|
||||
|
||||
g_value_init (&pcache->value, GDK_TYPE_COLOR);
|
||||
g_value_set_boxed (&pcache->value, &rgb);
|
||||
}
|
||||
}
|
||||
else
|
||||
g_param_value_set_default (pspec, &pcache->value);
|
||||
|
||||
gtk_symbolic_color_unref (color);
|
||||
}
|
||||
|
||||
return &pcache->value;
|
||||
|
Loading…
Reference in New Issue
Block a user