diff --git a/lib/mu-container.c b/lib/mu-container.c index fbe612ff..f0743ac5 100644 --- a/lib/mu-container.c +++ b/lib/mu-container.c @@ -275,8 +275,6 @@ mu_container_splice_children (MuContainer *c, MuContainer *sibling) children = sibling->child; sibling->child = NULL; - c = mu_container_remove_sibling (c, sibling); - return mu_container_append_siblings (c, children); } diff --git a/lib/mu-container.h b/lib/mu-container.h index 9f2686a8..6cd76889 100644 --- a/lib/mu-container.h +++ b/lib/mu-container.h @@ -128,14 +128,12 @@ MuContainer* mu_container_remove_child (MuContainer *c, MuContainer *child); MuContainer* mu_container_remove_sibling (MuContainer *c, MuContainer *sibling); /** - * promote sibling's children to be this container's siblings and - * remove the sibling + * promote sibling's children to be this container's siblings * * @param c a container instance * @param sibling a sibling of this container * - * @return the container with the sibling's children promoted and the - * sibling itself removed + * @return the container with the sibling's children promoted */ MuContainer* mu_container_splice_children (MuContainer *c, diff --git a/lib/mu-threader.c b/lib/mu-threader.c index c42e166c..1bb4c0f5 100644 --- a/lib/mu-threader.c +++ b/lib/mu-threader.c @@ -433,10 +433,12 @@ prune_empty_containers (MuContainer *root_set) /* and prune the root_set itself... */ for (cur = root_set; cur; cur = cur->next) { - if (cur->flags & MU_CONTAINER_FLAG_DELETE) + if (cur->flags & MU_CONTAINER_FLAG_DELETE) { root_set = mu_container_remove_sibling (root_set, cur); - else if (cur->flags & MU_CONTAINER_FLAG_SPLICE) + } else if (cur->flags & MU_CONTAINER_FLAG_SPLICE) { root_set = mu_container_splice_children (root_set, cur); + root_set = mu_container_remove_sibling (root_set, cur); + } } return root_set;