Fix T55462: Ungroup in Node editor crash Blender
authorSergey Sharybin <sergey.vfx@gmail.com>
Fri, 25 Jan 2019 15:49:40 +0000 (16:49 +0100)
committerSergey Sharybin <sergey.vfx@gmail.com>
Fri, 25 Jan 2019 15:49:40 +0000 (16:49 +0100)
If ID doesn't want to do user counting it shouldn't be in main.

source/blender/blenkernel/intern/node.c

index ea31ad0..5634d23 100644 (file)
@@ -1384,7 +1384,8 @@ void BKE_node_tree_copy_data(Main *UNUSED(bmain), bNodeTree *ntree_dst, const bN
 bNodeTree *ntreeCopyTree_ex(const bNodeTree *ntree, Main *bmain, const bool do_id_user)
 {
        bNodeTree *ntree_copy;
-       BKE_id_copy_ex(bmain, (ID *)ntree, (ID **)&ntree_copy, do_id_user ? 0 : LIB_ID_CREATE_NO_USER_REFCOUNT, false);
+       const int flag = do_id_user ? LIB_ID_CREATE_NO_USER_REFCOUNT | LIB_ID_CREATE_NO_MAIN : 0;
+       BKE_id_copy_ex(bmain, (ID *)ntree, (ID **)&ntree_copy, flag, false);
        return ntree_copy;
 }
 bNodeTree *ntreeCopyTree(Main *bmain, const bNodeTree *ntree)