diff --git a/ChangeLog b/ChangeLog index 88d7cb5aac..890ae7f5ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-04-07 Sven Neumann + + * app/widgets/gimpmessagebox.c: plugged a small memleak. + + * libgimpwidgets/gimpcontroller.c: added a finalizer and free the + allocated strings. + 2005-04-06 Sven Neumann * libgimpconfig/gimpconfig-utils.[ch]: added new function to reset diff --git a/app/widgets/gimpmessagebox.c b/app/widgets/gimpmessagebox.c index 5cf6286acb..ad9df2f5f6 100644 --- a/app/widgets/gimpmessagebox.c +++ b/app/widgets/gimpmessagebox.c @@ -356,12 +356,13 @@ gimp_message_box_set_label_text (GimpMessageBox *box, if (format) { - gchar *text = gimp_any_to_utf8 (g_strdup_vprintf (format, args), -1, - "Cannot convert text to utf8."); + gchar *text = g_strdup_vprintf (format, args); + gchar *utf8 = gimp_any_to_utf8 (text, -1, "Cannot convert text to utf8."); - gtk_label_set_text (GTK_LABEL (label), text); + gtk_label_set_text (GTK_LABEL (label), utf8); gtk_widget_show (label); + g_free (utf8); g_free (text); } else diff --git a/libgimpwidgets/gimpcontroller.c b/libgimpwidgets/gimpcontroller.c index 4d840d6e12..61c53276e0 100644 --- a/libgimpwidgets/gimpcontroller.c +++ b/libgimpwidgets/gimpcontroller.c @@ -49,6 +49,7 @@ enum static void gimp_controller_class_init (GimpControllerClass *klass); +static void gimp_controller_finalize (GObject *object); static void gimp_controller_set_property (GObject *object, guint property_id, const GValue *value, @@ -125,6 +126,7 @@ gimp_controller_class_init (GimpControllerClass *klass) parent_class = g_type_class_peek_parent (klass); + object_class->finalize = gimp_controller_finalize; object_class->set_property = gimp_controller_set_property; object_class->get_property = gimp_controller_get_property; @@ -159,6 +161,26 @@ gimp_controller_class_init (GimpControllerClass *klass) klass->event = NULL; } +static void +gimp_controller_finalize (GObject *object) +{ + GimpController *controller = GIMP_CONTROLLER (object); + + if (controller->name) + { + g_free (controller->name); + controller->name = NULL; + } + + if (controller->state) + { + g_free (controller->state); + controller->state = NULL; + } + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + static void gimp_controller_set_property (GObject *object, guint property_id,