new function (gtk_tree_store_clear): traverse the tree, so we emit

Fri Feb 15 19:38:00 2002  Kristian Rietveld  <kris@gtk.org>

        * gtk/gtktreestore.c (gtk_tree_store_clear_traverse): new function
        (gtk_tree_store_clear): traverse the tree, so we emit row_deleted
        for every node. This way we don't have confused row refs crashing the
        application. (#70631)
This commit is contained in:
Kristian Rietveld 2002-02-15 18:38:02 +00:00 committed by Kristian Rietveld
parent d7f8af9af0
commit baf21fbfa2
8 changed files with 91 additions and 8 deletions

View File

@ -1,3 +1,10 @@
Fri Feb 15 19:38:00 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreestore.c (gtk_tree_store_clear_traverse): new function
(gtk_tree_store_clear): traverse the tree, so we emit row_deleted
for every node. This way we don't have confused row refs crashing the
application. (#70631)
2002-02-14 Richard Hult <rhult@codefactory.se>
* gtk/gtkpaned.c (gtk_paned_enter): Only queue a draw on the

View File

@ -1,3 +1,10 @@
Fri Feb 15 19:38:00 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreestore.c (gtk_tree_store_clear_traverse): new function
(gtk_tree_store_clear): traverse the tree, so we emit row_deleted
for every node. This way we don't have confused row refs crashing the
application. (#70631)
2002-02-14 Richard Hult <rhult@codefactory.se>
* gtk/gtkpaned.c (gtk_paned_enter): Only queue a draw on the

View File

@ -1,3 +1,10 @@
Fri Feb 15 19:38:00 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreestore.c (gtk_tree_store_clear_traverse): new function
(gtk_tree_store_clear): traverse the tree, so we emit row_deleted
for every node. This way we don't have confused row refs crashing the
application. (#70631)
2002-02-14 Richard Hult <rhult@codefactory.se>
* gtk/gtkpaned.c (gtk_paned_enter): Only queue a draw on the

View File

@ -1,3 +1,10 @@
Fri Feb 15 19:38:00 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreestore.c (gtk_tree_store_clear_traverse): new function
(gtk_tree_store_clear): traverse the tree, so we emit row_deleted
for every node. This way we don't have confused row refs crashing the
application. (#70631)
2002-02-14 Richard Hult <rhult@codefactory.se>
* gtk/gtkpaned.c (gtk_paned_enter): Only queue a draw on the

View File

@ -1,3 +1,10 @@
Fri Feb 15 19:38:00 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreestore.c (gtk_tree_store_clear_traverse): new function
(gtk_tree_store_clear): traverse the tree, so we emit row_deleted
for every node. This way we don't have confused row refs crashing the
application. (#70631)
2002-02-14 Richard Hult <rhult@codefactory.se>
* gtk/gtkpaned.c (gtk_paned_enter): Only queue a draw on the

View File

@ -1,3 +1,10 @@
Fri Feb 15 19:38:00 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreestore.c (gtk_tree_store_clear_traverse): new function
(gtk_tree_store_clear): traverse the tree, so we emit row_deleted
for every node. This way we don't have confused row refs crashing the
application. (#70631)
2002-02-14 Richard Hult <rhult@codefactory.se>
* gtk/gtkpaned.c (gtk_paned_enter): Only queue a draw on the

View File

@ -1,3 +1,10 @@
Fri Feb 15 19:38:00 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreestore.c (gtk_tree_store_clear_traverse): new function
(gtk_tree_store_clear): traverse the tree, so we emit row_deleted
for every node. This way we don't have confused row refs crashing the
application. (#70631)
2002-02-14 Richard Hult <rhult@codefactory.se>
* gtk/gtkpaned.c (gtk_paned_enter): Only queue a draw on the

View File

@ -1423,6 +1423,47 @@ gtk_tree_store_iter_depth (GtkTreeStore *tree_store,
return g_node_depth (G_NODE (iter->user_data)) - 2;
}
/* simple ripoff from g_node_traverse_post_order */
static gboolean
gtk_tree_store_clear_traverse (GNode *node,
GtkTreeStore *store)
{
GtkTreeIter iter;
if (node->children)
{
GNode *child;
child = node->children;
while (child)
{
register GNode *current;
current = child;
child = current->next;
if (gtk_tree_store_clear_traverse (current, store))
return TRUE;
}
if (node->parent)
{
iter.stamp = store->stamp;
iter.user_data = node;
gtk_tree_store_remove (store, &iter);
}
}
else if (node->parent)
{
iter.stamp = store->stamp;
iter.user_data = node;
gtk_tree_store_remove (store, &iter);
}
return FALSE;
}
/**
* gtk_tree_store_clear:
* @tree_store: a #GtkTreeStore
@ -1432,16 +1473,9 @@ gtk_tree_store_iter_depth (GtkTreeStore *tree_store,
void
gtk_tree_store_clear (GtkTreeStore *tree_store)
{
GtkTreeIter iter;
g_return_if_fail (GTK_IS_TREE_STORE (tree_store));
while (G_NODE (tree_store->root)->children)
{
iter.stamp = tree_store->stamp;
iter.user_data = G_NODE (tree_store->root)->children;
gtk_tree_store_remove (tree_store, &iter);
}
gtk_tree_store_clear_traverse (tree_store->root, tree_store);
}
/* DND */