From c610b2daad3941c1eb75b1cf674428acf5d15dc4 Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Mon, 21 Jul 2008 20:27:33 +0000 Subject: [PATCH] always unset and ref the histograms. Plugs a memory leak reported by 2008-07-21 Sven Neumann * app/widgets/gimphistogrameditor.c (gimp_histogram_editor_set_image): always unset and ref the histograms. Plugs a memory leak reported by valgrind. svn path=/trunk/; revision=26263 --- ChangeLog | 6 ++++++ app/widgets/gimphistogrameditor.c | 26 +++++++++++++------------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3f59154065..f0882e6c8e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-07-21 Sven Neumann + + * app/widgets/gimphistogrameditor.c + (gimp_histogram_editor_set_image): always unset and ref the + histograms. Plugs a memory leak reported by valgrind. + 2008-07-21 Simon Budig * app/core/gimpcoords.c: incorporate the velocity. diff --git a/app/widgets/gimphistogrameditor.c b/app/widgets/gimphistogrameditor.c index 07ef2f11bb..51bfba26b6 100644 --- a/app/widgets/gimphistogrameditor.c +++ b/app/widgets/gimphistogrameditor.c @@ -77,7 +77,7 @@ static GimpDockedInterface *parent_docked_iface = NULL; static void -gimp_histogram_editor_class_init (GimpHistogramEditorClass* klass) +gimp_histogram_editor_class_init (GimpHistogramEditorClass *klass) { GimpImageEditorClass *image_editor_class = GIMP_IMAGE_EDITOR_CLASS (klass); @@ -256,22 +256,22 @@ gimp_histogram_editor_set_image (GimpImageEditor *image_editor, g_signal_handlers_disconnect_by_func (image_editor->image, gimp_histogram_editor_menu_update, editor); + } - if (editor->histogram) - { - gimp_histogram_unref (editor->histogram); - editor->histogram = NULL; + if (editor->histogram) + { + gimp_histogram_unref (editor->histogram); + editor->histogram = NULL; - gimp_histogram_view_set_histogram (view, NULL); - } + gimp_histogram_view_set_histogram (view, NULL); + } - if (editor->bg_histogram) - { - gimp_histogram_unref (editor->bg_histogram); - editor->bg_histogram = NULL; + if (editor->bg_histogram) + { + gimp_histogram_unref (editor->bg_histogram); + editor->bg_histogram = NULL; - gimp_histogram_view_set_background (view, NULL); - } + gimp_histogram_view_set_background (view, NULL); } GIMP_IMAGE_EDITOR_CLASS (parent_class)->set_image (image_editor, image);