Commit abe8d89f authored by Matthias Clasen's avatar Matthias Clasen
Browse files

Bug 553803 – eventually call XCloseDevice on XOpenDevice results

        * gdk/x11/gdkinput.c: Add a finalize function for device objects,
        and call XCloseDevice there.

        * gdk/x11/gdkinput-x11.c:
        * gdk/x11/gdkdisplay-x11.c: Move freeing of device objects to
        the finalize function.
        Patch by Caolan McNamara


svn path=/trunk/; revision=21529
parent 47403317
2008-09-26 Matthias Clasen <mclasen@redhat.com>
Bug 553803 – eventually call XCloseDevice on XOpenDevice results
* gdk/x11/gdkinput.c: Add a finalize function for device objects,
and call XCloseDevice there.
* gdk/x11/gdkinput-x11.c:
* gdk/x11/gdkdisplay-x11.c: Move freeing of device objects to
the finalize function.
Patch by Caolan McNamara
2008-09-26 Matthias Clasen <mclasen@redhat.com>
Bug 553578 - tabs are not drawn correctly
......
......@@ -830,7 +830,6 @@ gdk_display_x11_finalize (GObject *object)
g_slist_free (display_x11->event_types);
/* input GdkDevice list */
/* FIXME need to write finalize fct */
g_list_foreach (display_x11->input_devices, (GFunc) g_object_unref, NULL);
g_list_free (display_x11->input_devices);
......
......@@ -246,10 +246,6 @@ gdk_input_device_new (GdkDisplay *display,
error:
g_free (gdkdev->info.name);
g_free (gdkdev->axes);
g_free (gdkdev->info.keys);
g_free (gdkdev->info.axes);
g_object_unref (gdkdev);
return NULL;
......
......@@ -63,6 +63,9 @@ _gdk_init_input_core (GdkDisplay *display)
private->display = display;
}
static void gdk_device_class_init (GdkDeviceClass *klass);
static void gdk_device_finalize (GObject *object);
GType
gdk_device_get_type (void)
{
......@@ -75,7 +78,7 @@ gdk_device_get_type (void)
sizeof (GdkDeviceClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) NULL,
(GClassInitFunc) gdk_device_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GdkDevicePrivate),
......@@ -91,6 +94,33 @@ gdk_device_get_type (void)
return object_type;
}
static void
gdk_device_class_init (GdkDeviceClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = gdk_device_finalize;
}
static void
gdk_device_finalize (GObject *object)
{
GdkDevicePrivate *gdkdev = (GdkDevicePrivate *)GDK_DEVICE(object);
if (!GDK_IS_CORE (gdkdev))
{
#ifndef XINPUT_NONE
if (gdkdev->xdevice)
XCloseDevice (GDK_DISPLAY_XDISPLAY(gdkdev->display), gdkdev->xdevice);
g_free (gdkdev->axes);
#endif /* !XINPUT_NONE */
g_free (gdkdev->info.name);
g_free (gdkdev->info.keys);
g_free (gdkdev->info.axes);
}
}
/**
* gdk_devices_list:
*
......@@ -403,14 +433,7 @@ _gdk_input_exit (void)
if (!GDK_IS_CORE (gdkdev))
{
gdk_device_set_mode (&gdkdev->info, GDK_MODE_DISABLED);
g_free(gdkdev->info.name);
#ifndef XINPUT_NONE
g_free(gdkdev->axes);
#endif
g_free(gdkdev->info.axes);
g_free(gdkdev->info.keys);
g_free(gdkdev);
g_object_unref(gdkdev);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment