plugged a small memleak.

2005-04-07  Sven Neumann  <sven@gimp.org>

	* app/widgets/gimpmessagebox.c: plugged a small memleak.

	* libgimpwidgets/gimpcontroller.c: added a finalizer and free the
	allocated strings.
This commit is contained in:
Sven Neumann 2005-04-06 23:19:04 +00:00 committed by Sven Neumann
parent 32ebceb83c
commit d0c80e7629
3 changed files with 33 additions and 3 deletions

View File

@ -1,3 +1,10 @@
2005-04-07 Sven Neumann <sven@gimp.org>
* app/widgets/gimpmessagebox.c: plugged a small memleak.
* libgimpwidgets/gimpcontroller.c: added a finalizer and free the
allocated strings.
2005-04-06 Sven Neumann <sven@gimp.org>
* libgimpconfig/gimpconfig-utils.[ch]: added new function to reset

View File

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

View File

@ -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,