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:

committed by
Sven Neumann

parent
32ebceb83c
commit
d0c80e7629
@ -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,
|
||||
|
Reference in New Issue
Block a user