diff --git a/engine/breeze/ui/ui.c b/engine/breeze/ui/ui.c index 00abef3..ef22b48 100644 --- a/engine/breeze/ui/ui.c +++ b/engine/breeze/ui/ui.c @@ -283,15 +283,15 @@ static void pruneStale(BzUI *ui, BzUINode *node) { while (child != NULL) { if (child->lastFrame != node->lastFrame) { BzUINode *next = child->next; - removeNode(ui, child); - if (child->prev) { + if (child->prev) child->prev->next = next; - } + removeNode(ui, child); + if (next) + next->prev = child; child = next; } else { - if (!first) { + if (!first) first = child; - } pruneStale(ui, child); last = child; child = child->next; @@ -402,6 +402,8 @@ BzUINode *bzUINodeMake(BzUI *ui, BzUIKey key, const BzUINodeDesc *desc) { BzUINode *parent = bzArrayGet(ui->nodeStack, bzArraySize(ui->nodeStack) - 1); BZ_ASSERT(parent); + bzUINodeClearLinks(node); + if (parent->last) { parent->last->next = node; node->prev = parent->last;