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:
parent
c8792ccfa6
commit
0fd6ae5330
@ -293,8 +293,6 @@ on_apps_tree_changed_cb (GMenuTree *tree,
|
|||||||
GHashTable *new_apps;
|
GHashTable *new_apps;
|
||||||
GHashTableIter iter;
|
GHashTableIter iter;
|
||||||
gpointer key, value;
|
gpointer key, value;
|
||||||
GSList *removed_apps = NULL;
|
|
||||||
GSList *removed_node;
|
|
||||||
|
|
||||||
g_assert (tree == self->priv->apps_tree);
|
g_assert (tree == self->priv->apps_tree);
|
||||||
|
|
||||||
@ -376,15 +374,9 @@ on_apps_tree_changed_cb (GMenuTree *tree,
|
|||||||
const char *id = key;
|
const char *id = key;
|
||||||
|
|
||||||
if (!g_hash_table_lookup (new_apps, id))
|
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_hash_table_destroy (new_apps);
|
||||||
|
|
||||||
g_signal_emit (self, signals[INSTALLED_CHANGED], 0);
|
g_signal_emit (self, signals[INSTALLED_CHANGED], 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user