aboutsummaryrefslogtreecommitdiff
path: root/src/udev-mgr.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/udev-mgr.c')
-rw-r--r--src/udev-mgr.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/src/udev-mgr.c b/src/udev-mgr.c
index cbb7dcb..5ac286e 100644
--- a/src/udev-mgr.c
+++ b/src/udev-mgr.c
@@ -45,9 +45,14 @@ static void udev_mgr_handle_scsi_device (UdevMgr* self,
GUdevDevice* device,
UdevMgrDeviceAction action);
+static void udev_mgr_cleanup_lists(gpointer data, gpointer self);
+static void udev_mgr_cleanup_entries(gpointer data, gpointer self);
+
+
static void debug_device (UdevMgr* self,
GUdevDevice* device,
UdevMgrDeviceAction action);
+
struct _UdevMgr
{
@@ -80,11 +85,11 @@ udev_mgr_init (UdevMgr* self)
self->supported_usb_scanners = g_hash_table_new_full (g_str_hash,
g_str_equal,
g_free,
- (GDestroyNotify)g_list_free);
+ (GDestroyNotify)udev_mgr_cleanup_lists);
self->supported_scsi_scanners = g_hash_table_new_full (g_str_hash,
g_str_equal,
g_free,
- (GDestroyNotify)g_list_free);
+ (GDestroyNotify)udev_mgr_cleanup_lists);
self->scanners_present = g_hash_table_new_full (g_str_hash,
g_str_equal,
g_free,
@@ -104,6 +109,21 @@ udev_mgr_init (UdevMgr* self)
}
static void
+udev_mgr_cleanup_lists(gpointer data, gpointer self)
+{
+ GList* scanners = (GList*)data;
+ g_list_foreach (scanners, udev_mgr_cleanup_entries, NULL);
+ g_list_free(scanners);
+}
+
+static void
+udev_mgr_cleanup_entries(gpointer data, gpointer self)
+{
+ gchar* entry = (gchar*)data;
+ g_free(entry);
+}
+
+static void
udev_mgr_finalize (GObject *object)
{
UdevMgr* self = UDEV_MGR (object);
@@ -283,9 +303,8 @@ static void udev_mgr_handle_scsi_device (UdevMgr* self,
if (g_strcmp0 (type, "6") == 0){
gchar* random_scanner_name = g_strdup_printf("%p--scanner", self);
g_hash_table_insert (self->scanners_present,
- g_strdup(random_scanner_name),
+ random_scanner_name,
g_strdup("Scanner"));
- g_free (random_scanner_name);
udev_mgr_update_menuitems (self);
return;
}