app-system: Use g_hash_table_iter_remove

glib now provides an iteration-safe way to remove items from
the hash table, so use it instead of building a separate list.

https://bugzilla.gnome.org/show_bug.cgi?id=698486
This commit is contained in:
Jasper St. Pierre 2013-03-16 16:50:16 -04:00
parent c8792ccfa6
commit 0fd6ae5330

View File

@ -293,8 +293,6 @@ on_apps_tree_changed_cb (GMenuTree *tree,
GHashTable *new_apps;
GHashTableIter iter;
gpointer key, value;
GSList *removed_apps = NULL;
GSList *removed_node;
g_assert (tree == self->priv->apps_tree);
@ -376,15 +374,9 @@ on_apps_tree_changed_cb (GMenuTree *tree,
const char *id = key;
if (!g_hash_table_lookup (new_apps, id))
removed_apps = g_slist_prepend (removed_apps, (char*)id);
g_hash_table_iter_remove (&iter);
}
for (removed_node = removed_apps; removed_node; removed_node = removed_node->next)
{
const char *id = removed_node->data;
g_hash_table_remove (self->priv->id_to_app, id);
}
g_slist_free (removed_apps);
g_hash_table_destroy (new_apps);
g_signal_emit (self, signals[INSTALLED_CHANGED], 0);