GdkDevice: Do not free construct-only properties data on dispose()

Those are not references to other objects, and the device will be mostly
useless if those can't be set again anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=756625
This commit is contained in:
Carlos Garnacho 2015-10-16 19:52:50 +02:00
parent 4f61fd09c5
commit 7d8a3a52ce

View File

@ -63,6 +63,7 @@ enum {
static guint signals [LAST_SIGNAL] = { 0 };
static void gdk_device_finalize (GObject *object);
static void gdk_device_dispose (GObject *object);
static void gdk_device_set_property (GObject *object,
guint prop_id,
@ -99,6 +100,7 @@ gdk_device_class_init (GdkDeviceClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = gdk_device_finalize;
object_class->dispose = gdk_device_dispose;
object_class->set_property = gdk_device_set_property;
object_class->get_property = gdk_device_get_property;
@ -298,6 +300,25 @@ gdk_device_init (GdkDevice *device)
device->axes = g_array_new (FALSE, TRUE, sizeof (GdkAxisInfo));
}
static void
gdk_device_finalize (GObject *object)
{
GdkDevice *device = GDK_DEVICE (object);
if (device->axes)
{
g_array_free (device->axes, TRUE);
device->axes = NULL;
}
g_clear_pointer (&device->name, g_free);
g_clear_pointer (&device->keys, g_free);
g_clear_pointer (&device->vendor_id, g_free);
g_clear_pointer (&device->product_id, g_free);
G_OBJECT_CLASS (gdk_device_parent_class)->finalize (object);
}
static void
gdk_device_dispose (GObject *object)
{
@ -315,21 +336,6 @@ gdk_device_dispose (GObject *object)
device->associated = NULL;
}
if (device->axes)
{
g_array_free (device->axes, TRUE);
device->axes = NULL;
}
g_free (device->name);
g_free (device->keys);
device->name = NULL;
device->keys = NULL;
g_clear_pointer (&device->vendor_id, g_free);
g_clear_pointer (&device->product_id, g_free);
G_OBJECT_CLASS (gdk_device_parent_class)->dispose (object);
}