always unset and ref the histograms. Plugs a memory leak reported by

2008-07-21  Sven Neumann  <sven@gimp.org>

	* 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
This commit is contained in:
Sven Neumann 2008-07-21 20:27:33 +00:00 committed by Sven Neumann
parent 862b2a2913
commit c610b2daad
2 changed files with 19 additions and 13 deletions

View File

@ -1,3 +1,9 @@
2008-07-21 Sven Neumann <sven@gimp.org>
* 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 <simon@gimp.org>
* app/core/gimpcoords.c: incorporate the velocity.

View File

@ -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);