mu: Prune empty containers from the root set after splicing their children
When the root set contains only one empty container with one child first promote the child container to the root set and only then remove the empty parent container so that the root set never goes empty. Also make mu_container_splice_children() do only one thing, that is promote one container's children to be another container's siblings. The resultant childless container is no longer removed by this function. Fixes #460.
This commit is contained in:
@ -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;
|
||||
|
||||
Reference in New Issue
Block a user