[poincare] Fix TreeReference::replaceTreeChildAtIndex

This commit is contained in:
Léa Saviot
2018-07-12 10:37:30 +02:00
parent f48c9f53d2
commit 4e4c1bb2ad

View File

@@ -185,7 +185,9 @@ public:
assert(oldChildIndex >= 0 && oldChildIndex < numberOfChildren());
TreeReference<T> oldChild = treeChildAtIndex(oldChildIndex);
TreePool::sharedPool()->move(oldChild.node()->next(), newChild.node());
newChild.node()->retain();
if (!p.isDefined()) {
newChild.node()->retain();
}
TreePool::sharedPool()->move(TreePool::sharedPool()->last(), oldChild.node());
oldChild.node()->release();
}