[Xfce4-commits] <tumbler:master> Remove empty lists from the hash table when a directory is deleted.
Jannis Pohlmann
noreply at xfce.org
Tue Nov 17 12:36:01 CET 2009
Updating branch refs/heads/master
to 55dc1edd234547f6fef7aa09c797e3409a7548c6 (commit)
from 593fd5894e714b1bd46f736a0604bfdafb8603f5 (commit)
commit 55dc1edd234547f6fef7aa09c797e3409a7548c6
Author: Jannis Pohlmann <jannis at xfce.org>
Date: Tue Nov 17 12:34:19 2009 +0100
Remove empty lists from the hash table when a directory is deleted.
tumblerd/tumbler-manager.c | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/tumblerd/tumbler-manager.c b/tumblerd/tumbler-manager.c
index 7728cc1..1b14117 100644
--- a/tumblerd/tumbler-manager.c
+++ b/tumblerd/tumbler-manager.c
@@ -1394,7 +1394,9 @@ tumbler_manager_directory_deleted (TumblerManager *manager,
ThumbnailerInfo *info;
ThumbnailerInfo *info2;
GHashTableIter iter;
+ const gchar *hash_key;
GFile *file;
+ GList *delete_keys;
GList **list;
GList *lp;
GStrv hash_keys;
@@ -1411,7 +1413,7 @@ tumbler_manager_directory_deleted (TumblerManager *manager,
/* iterate over all thumbnailer info lists */
g_hash_table_iter_init (&iter, manager->thumbnailers);
- while (g_hash_table_iter_next (&iter, NULL, (gpointer) &list))
+ while (g_hash_table_iter_next (&iter, (gpointer) &hash_key, (gpointer) &list))
{
/* all lists in the hash table should be defined and non-empty */
g_assert (list != NULL);
@@ -1473,7 +1475,15 @@ tumbler_manager_directory_deleted (TumblerManager *manager,
thumbnailer_info_free (info);
}
}
+
+ if (*list == NULL)
+ delete_keys = g_list_prepend (delete_keys, (gpointer) hash_key);
}
+
+ for (lp = delete_keys; lp != NULL; lp = lp->next)
+ g_hash_table_remove (manager->thumbnailers, (const gchar *)lp->data);
+
+ g_list_free (delete_keys);
}
@@ -1632,6 +1642,10 @@ tumbler_manager_directory_changed (TumblerManager *manager,
if (dir_index >= 0)
{
+#ifdef DEBUG
+ g_debug (" %s created", g_file_get_path (file));
+#endif
+
g_mutex_lock (manager->mutex);
tumbler_manager_directory_created (manager, file, dir_index);
tumbler_registry_update_supported (manager->registry);
More information about the Xfce4-commits
mailing list