[poincare] Fix TreeReference::replaceTreeChild

This commit is contained in:
Léa Saviot
2018-08-01 16:52:42 +02:00
parent d89e078e0e
commit f37ef1303d

View File

@@ -118,7 +118,10 @@ void TreeReference::replaceTreeChild(TreeReference oldChild, TreeReference newCh
}
// Move the new child
TreePool::sharedPool()->move(oldChild.node()->nextSibling(), newChild.node(), newChild.numberOfChildren());
TreePool::sharedPool()->move(oldChild.node(), newChild.node(), newChild.numberOfChildren());
/* We could have moved the new node to oldChild.node()->nextSibling(), but
* nextSibling is not computed correctly if we inserted an
* AllocationFailureNode next to newChild. */
if (!p.isDefined()) {
newChild.node()->retain();