summaryrefslogtreecommitdiff
path: root/embed/ephy-history.c
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@gnome.org>2003-10-19 13:29:46 +0000
committerMarco Pesenti Gritti <marco@src.gnome.org>2003-10-19 13:29:46 +0000
commit89f824edb461ffa185ca78962f39f582919544f4 (patch)
tree7f9f062d10397f7d3abb613eaa5fa78179cb9e1d /embed/ephy-history.c
parent4e2ac65da1cf8ac42f4dbbbb1f7fe3e021433565 (diff)
downloadepiphany-89f824edb461ffa185ca78962f39f582919544f4.tar.gz
We cant remove while iterating childrens, build a list and remove later.
2003-10-19 Marco Pesenti Gritti <marco@gnome.org> * embed/ephy-history.c: (update_host_on_child_remove), (update_hosts): We cant remove while iterating childrens, build a list and remove later.
Diffstat (limited to 'embed/ephy-history.c')
-rw-r--r--embed/ephy-history.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/embed/ephy-history.c b/embed/ephy-history.c
index d3991bea6..197ad85d3 100644
--- a/embed/ephy-history.c
+++ b/embed/ephy-history.c
@@ -289,12 +289,6 @@ update_host_on_child_remove (EphyNode *node)
GPtrArray *children;
int i, host_last_visit, new_host_last_visit = 0;
- if (ephy_node_get_n_children (node) == 0)
- {
- ephy_node_unref (node);
- return;
- }
-
host_last_visit = ephy_node_get_property_int
(node, EPHY_NODE_PAGE_PROP_LAST_VISIT);
@@ -333,19 +327,31 @@ update_hosts (EphyHistory *eh)
{
GPtrArray *children;
int i;
+ GList *empty = NULL;
children = ephy_node_get_children (eh->priv->hosts);
- ephy_node_thaw (eh->priv->hosts);
for (i = 0; i < children->len; i++)
{
EphyNode *kid;
kid = g_ptr_array_index (children, i);
+
if (kid != eh->priv->pages)
{
- update_host_on_child_remove (kid);
+ if (ephy_node_get_n_children (kid) > 0)
+ {
+ update_host_on_child_remove (kid);
+ }
+ else
+ {
+ empty = g_list_prepend (empty, kid);
+ }
}
}
+ ephy_node_thaw (eh->priv->hosts);
+
+ g_list_foreach (empty, (GFunc)ephy_node_unref, NULL);
+ g_list_free (empty);
eh->priv->update_hosts_idle = 0;