[gtk+] GtkCssImageIconName: Plug a memory leak
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] GtkCssImageIconName: Plug a memory leak
- Date: Sun, 29 Jun 2014 02:41:23 +0000 (UTC)
commit d1439195279b1bcf193e9abe44e033c0c3ea66b2
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Jun 28 22:39:02 2014 -0400
GtkCssImageIconName: Plug a memory leak
valgrind was complaining that we're not freeing the icon_name.
gtk/gtkcssimageicontheme.c | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkcssimageicontheme.c b/gtk/gtkcssimageicontheme.c
index 91cfb6d..dfc73cd 100644
--- a/gtk/gtkcssimageicontheme.c
+++ b/gtk/gtkcssimageicontheme.c
@@ -155,7 +155,7 @@ gtk_css_image_icon_theme_compute (GtkCssImage *image,
static gboolean
gtk_css_image_icon_theme_equal (GtkCssImage *image1,
- GtkCssImage *image2)
+ GtkCssImage *image2)
{
GtkCssImageIconTheme *icon_theme1 = GTK_CSS_IMAGE_ICON_THEME (image1);
GtkCssImageIconTheme *icon_theme2 = GTK_CSS_IMAGE_ICON_THEME (image2);
@@ -164,9 +164,21 @@ gtk_css_image_icon_theme_equal (GtkCssImage *image1,
}
static void
+gtk_css_image_icon_theme_dispose (GObject *object)
+{
+ GtkCssImageIconTheme *icon_theme = GTK_CSS_IMAGE_ICON_THEME (object);
+
+ g_free (icon_theme->name);
+ icon_theme->name = NULL;
+
+ G_OBJECT_CLASS (_gtk_css_image_icon_theme_parent_class)->dispose (object);
+}
+
+static void
_gtk_css_image_icon_theme_class_init (GtkCssImageIconThemeClass *klass)
{
GtkCssImageClass *image_class = GTK_CSS_IMAGE_CLASS (klass);
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
image_class->get_aspect_ratio = gtk_css_image_icon_theme_get_aspect_ratio;
image_class->draw = gtk_css_image_icon_theme_draw;
@@ -174,6 +186,8 @@ _gtk_css_image_icon_theme_class_init (GtkCssImageIconThemeClass *klass)
image_class->print = gtk_css_image_icon_theme_print;
image_class->compute = gtk_css_image_icon_theme_compute;
image_class->equal = gtk_css_image_icon_theme_equal;
+
+ object_class->dispose = gtk_css_image_icon_theme_dispose;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]