[gtk+] Fix leak in GtkStyle.



commit 7a623988e5566a32f60b579b1c701b563f70d677
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sat Dec 25 11:59:56 2010 +0100

    Fix leak in GtkStyle.

 gtk/gtkstyle.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkstyle.c b/gtk/gtkstyle.c
index 40c3928..5eb6a20 100644
--- a/gtk/gtkstyle.c
+++ b/gtk/gtkstyle.c
@@ -745,9 +745,14 @@ gtk_style_update_from_context (GtkStyle *style)
   style->white.blue = 0xffff;
 
   for (i = 0; i < 5; i++)
-    style->background[i] = cairo_pattern_create_rgb (style->bg[i].red / 65535.0,
-                                                     style->bg[i].green / 65535.0,
-                                                     style->bg[i].blue / 65535.0);
+    {
+      if (style->background[i])
+        cairo_pattern_destroy (style->background[i]);
+
+      style->background[i] = cairo_pattern_create_rgb (style->bg[i].red / 65535.0,
+                                                       style->bg[i].green / 65535.0,
+                                                       style->bg[i].blue / 65535.0);
+    }
 }
 
 static void



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