[vlc-devel] commit: udev: remove remaining items at exit ( Rémi Denis-Courmont )
git version control
git at videolan.org
Wed Oct 28 17:28:51 CET 2009
vlc | branch: 1.0-bugfix | Rémi Denis-Courmont <remi at remlab.net> | Wed Oct 28 18:27:56 2009 +0200| [25629f733c5aa1f235d98581263b3693cc1a3b1e] | committer: Rémi Denis-Courmont
udev: remove remaining items at exit
(cherry picked from commit 49661f4c7c324bcb42f496c02d2cd874f514d8a9)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=25629f733c5aa1f235d98581263b3693cc1a3b1e
---
modules/services_discovery/udev.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/modules/services_discovery/udev.c b/modules/services_discovery/udev.c
index 14f6d04..0a85c88 100644
--- a/modules/services_discovery/udev.c
+++ b/modules/services_discovery/udev.c
@@ -63,6 +63,7 @@ struct device
{
dev_t devnum; /* must be first */
input_item_t *item;
+ services_discovery_t *sd;
};
struct subsys
@@ -99,6 +100,8 @@ static void DestroyDevice (void *data)
{
struct device *d = data;
+ if (d->sd)
+ services_discovery_RemoveItem (d->sd, d->item);
vlc_gc_decref (d->item);
free (d);
}
@@ -132,8 +135,9 @@ static int AddDevice (services_discovery_t *sd, struct udev_device *dev)
vlc_gc_decref (item);
return -1;
}
- d->item = item;
d->devnum = udev_device_get_devnum (dev);
+ d->item = item;
+ d->sd = NULL;
struct device **dp = tsearch (d, &p_sys->root, cmpdev);
if (dp == NULL) /* Out-of-memory */
@@ -143,13 +147,13 @@ static int AddDevice (services_discovery_t *sd, struct udev_device *dev)
}
if (*dp != d) /* Overwrite existing device */
{
- services_discovery_RemoveItem (sd, (*dp)->item);
DestroyDevice (*dp);
*dp = d;
}
name = p_sys->subsys->get_cat (dev);
services_discovery_AddItem (sd, item, name ? name : "Generic");
+ d->sd = sd;
free (name);
return 0;
}
@@ -167,7 +171,6 @@ static void RemoveDevice (services_discovery_t *sd, struct udev_device *dev)
return;
struct device *d = *dp;
- services_discovery_RemoveItem (sd, d->item);
tdelete (d, &p_sys->root, cmpdev);
DestroyDevice (d);
}
More information about the vlc-devel
mailing list