[gtk+] Plugged memory leak in gtk_style_finalize (destroy the ->background[] patterns).



commit c35fb706bddd5e76dfec2964d67f3aa1ba5a169b
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Sun Jan 16 20:17:52 2011 +0900

    Plugged memory leak in gtk_style_finalize (destroy the ->background[] patterns).

 gtk/gtkstyle.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkstyle.c b/gtk/gtkstyle.c
index f9abf8d..9fd3bfb 100644
--- a/gtk/gtkstyle.c
+++ b/gtk/gtkstyle.c
@@ -513,6 +513,7 @@ gtk_style_finalize (GObject *object)
 {
   GtkStyle *style = GTK_STYLE (object);
   GtkStylePrivate *priv = GTK_STYLE_GET_PRIVATE (style);
+  gint i;
 
   g_return_if_fail (style->attach_count == 0);
 
@@ -559,6 +560,12 @@ gtk_style_finalize (GObject *object)
       g_object_unref (priv->context);
     }
 
+  for (i = 0; i < 5; i++)
+    {
+      if (style->background[i])
+        cairo_pattern_destroy (style->background[i]);
+    }
+
   G_OBJECT_CLASS (gtk_style_parent_class)->finalize (object);
 }
 



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