[gtk+] GdkDevice: Do not free construct-only properties data on dispose()
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] GdkDevice: Do not free construct-only properties data on dispose()
- Date: Tue, 3 Nov 2015 12:34:08 +0000 (UTC)
commit 7d8a3a52ce445bb0c0fe6a4e30526e1bc864fc4f
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri Oct 16 19:52:50 2015 +0200
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
gdk/gdkdevice.c | 36 +++++++++++++++++++++---------------
1 files changed, 21 insertions(+), 15 deletions(-)
---
diff --git a/gdk/gdkdevice.c b/gdk/gdkdevice.c
index 86bfbf4..a1a59d2 100644
--- a/gdk/gdkdevice.c
+++ b/gdk/gdkdevice.c
@@ -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;
@@ -299,6 +301,25 @@ gdk_device_init (GdkDevice *device)
}
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)
{
GdkDevice *device = GDK_DEVICE (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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]