Tree: Adopt children properly when moving a node to another tree. Fixes #1689.
Merge branch 'tree-adoption-fix' into dev-master
Build tree.