[gtk+/gtk-style-context] GtkThemingEngine: Be a bit more robust against missing essential properties.



commit 41b2660a0dee4ecdfa7b8b0454d9f91c9232499a
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Dec 3 12:25:12 2010 +0100

    GtkThemingEngine: Be a bit more robust against missing essential properties.

 gtk/gtkthemingengine.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkthemingengine.c b/gtk/gtkthemingengine.c
index 7469aef..2b9c4ce 100644
--- a/gtk/gtkthemingengine.c
+++ b/gtk/gtkthemingengine.c
@@ -2278,12 +2278,16 @@ gtk_theming_engine_render_layout (GtkThemingEngine *engine,
                               "color", &other_fg,
                               NULL);
 
-      fg_color->red = CLAMP (fg_color->red + ((other_fg->red - fg_color->red) * progress), 0, 1);
-      fg_color->green = CLAMP (fg_color->green + ((other_fg->green - fg_color->green) * progress), 0, 1);
-      fg_color->blue = CLAMP (fg_color->blue + ((other_fg->blue - fg_color->blue) * progress), 0, 1);
-      fg_color->alpha = CLAMP (fg_color->alpha + ((other_fg->alpha - fg_color->alpha) * progress), 0, 1);
+      if (fg_color && other_fg)
+        {
+          fg_color->red = CLAMP (fg_color->red + ((other_fg->red - fg_color->red) * progress), 0, 1);
+          fg_color->green = CLAMP (fg_color->green + ((other_fg->green - fg_color->green) * progress), 0, 1);
+          fg_color->blue = CLAMP (fg_color->blue + ((other_fg->blue - fg_color->blue) * progress), 0, 1);
+          fg_color->alpha = CLAMP (fg_color->alpha + ((other_fg->alpha - fg_color->alpha) * progress), 0, 1);
+        }
 
-      gdk_rgba_free (other_fg);
+      if (other_fg)
+        gdk_rgba_free (other_fg);
     }
 
   if (matrix)



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