diff options
Diffstat (limited to 'gtk/gtkrbtree.c')
-rw-r--r-- | gtk/gtkrbtree.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/gtk/gtkrbtree.c b/gtk/gtkrbtree.c index 8259b91fde..e8bbf2d9d0 100644 --- a/gtk/gtkrbtree.c +++ b/gtk/gtkrbtree.c @@ -641,7 +641,12 @@ _gtk_rbtree_node_find_offset (GtkRBTree *tree, GtkRBNode *node) { GtkRBNode *last; - gint retval = node->left->offset; + gint retval; + + g_assert (node); + g_assert (node->left); + + retval = node->left->offset; while (tree && node && node != tree->nil) { @@ -904,6 +909,22 @@ _gtk_rbtree_prev_full (GtkRBTree *tree, } } +gint +_gtk_rbtree_get_depth (GtkRBTree *tree) +{ + GtkRBTree *tmp_tree; + gint depth = 0; + + tmp_tree = tree->parent_tree; + while (tmp_tree) + { + ++depth; + tmp_tree = tmp_tree->parent_tree; + } + + return depth; +} + static void _gtk_rbtree_traverse_pre_order (GtkRBTree *tree, GtkRBNode *node, |