[gtk] rbtree: Fix removing last element
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk] rbtree: Fix removing last element
- Date: Mon, 14 Jan 2019 17:51:23 +0000 (UTC)
commit e10433770482047e0c522f8a0fbb5a320c156b04
Author: Benjamin Otte <otte redhat com>
Date: Mon Jan 14 18:42:18 2019 +0100
rbtree: Fix removing last element
The refactoring of automatically updating tree->root when setting a
node's parent works very well - unless all nodes get removed and no
node's parent got updated.
gtk/gtkrbtree.c | 5 +++++
1 file changed, 5 insertions(+)
---
diff --git a/gtk/gtkrbtree.c b/gtk/gtkrbtree.c
index 4e52189233..85055b1cb4 100644
--- a/gtk/gtkrbtree.c
+++ b/gtk/gtkrbtree.c
@@ -708,6 +708,11 @@ gtk_rb_tree_remove (GtkRbTree *tree,
p->right = x;
gtk_rb_node_mark_dirty (p, TRUE);
}
+ else
+ {
+ if (x == NULL)
+ tree->root = NULL;
+ }
/* We need to clean up the validity of the tree.
*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]