From c9b084dc1636c15b300ebbf7024f8e4321376099 Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Tue, 8 Jun 2010 16:08:48 -0400 Subject: [PATCH] Don't leak the object path --- src/linuxdevice.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/linuxdevice.c b/src/linuxdevice.c index 08e87e4..fd77794 100644 --- a/src/linuxdevice.c +++ b/src/linuxdevice.c @@ -274,12 +274,23 @@ linux_device_update (LinuxDevice *device) { g_return_if_fail (IS_LINUX_DEVICE (device)); + /* Handle first init, typically one-time / constant properties etc. is computed here */ + if (device->priv->object_path == NULL) + { + device->priv->object_path = util_compute_object_path (g_udev_device_get_sysfs_path (device->priv->udev_device)); + } + + /* set all properties that can vary */ device_set_native_path (DEVICE (device), g_udev_device_get_sysfs_path (device->priv->udev_device)); - /* TODO */ + /* TODO: actually compute whether the object is visible */ device->priv->visible = TRUE; - device->priv->object_path = util_compute_object_path (device_get_native_path (DEVICE (device))); + /* TODO: this is just for fun to show that the PropertiesChanged() signal is + * emitted - e.g. if you do 'udevadm trigger --sysname-match=sda' then + * the daemon receives a 'change' uevent for sda and this function is called + * by the LinuxDaemon logic. + */ device_set_device_detection_time (DEVICE (device), device_get_device_detection_time (DEVICE (device)) + 1); device_set_device_media_detection_time (DEVICE (device), device_get_device_media_detection_time (DEVICE (device)) + 2); } -- 2.7.4