从父节点中移除失败

//注:this.pool是一个map集合类,我在本类里做的缓存池
//这样报错 Internal error, should not remove unknown node from parent.
var prefabInstance = layout._children;

        var newArr = [];
        var node;
        while (node = prefabInstance.shift()){

            // var node = prefabInstance.shift();
            node.parent = null;

            newArr.push(node);

        }

        this.pool.set(childName + "_prefab", newArr);

//另一种for循环 然后逐个设置parent = null ,但是不生效,设置不成功,

//如果直接从父节点removeAllChildren,this.pool里面的值会全部消失 ,数组会被清空

求各位大神的解决方案

另外补充一句。。。。prefabInstance这里面的子节点全部是动态生成的

有大神没。。。。帮帮忙

解决了吗,我也遇到了,有时候正常,有时候报错