[Bf-blender-cvs] [65d4314b8e4] master: Fix (unreported) bad halding of ID usercounts when fully copying a scene.

Bastien Montagne noreply at git.blender.org
Wed Oct 24 08:58:41 CEST 2018


Commit: 65d4314b8e43c0d1e30ec105a929a1adf4268d01
Author: Bastien Montagne
Date:   Wed Oct 24 08:43:20 2018 +0200
Branches: master
https://developer.blender.org/rB65d4314b8e43c0d1e30ec105a929a1adf4268d01

Fix (unreported) bad halding of ID usercounts when fully copying a scene.

===================================================================

M	source/blender/blenkernel/intern/scene.c

===================================================================

diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 1eb65519596..3a067221aad 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -402,6 +402,7 @@ Scene *BKE_scene_copy(Main *bmain, Scene *sce, int type)
 			for (SceneRenderLayer *srl_dst = sce_copy->r.layers.first; srl_dst; srl_dst = srl_dst->next) {
 				for (FreestyleLineSet *lineset = srl_dst->freestyleConfig.linesets.first; lineset; lineset = lineset->next) {
 					if (lineset->linestyle) {
+						id_us_min(&lineset->linestyle->id);
 						/* XXX Not copying anim/actions here? */
 						BKE_id_copy_ex(bmain, (ID *)lineset->linestyle, (ID **)&lineset->linestyle, 0, false);
 					}
@@ -410,12 +411,14 @@ Scene *BKE_scene_copy(Main *bmain, Scene *sce, int type)
 
 			/* Full copy of world (included animations) */
 			if (sce_copy->world) {
+				id_us_min(&sce_copy->world->id);
 				BKE_id_copy_ex(bmain, (ID *)sce_copy->world, (ID **)&sce_copy->world, LIB_ID_COPY_ACTIONS, false);
 			}
 
 			/* Full copy of GreasePencil. */
 			/* XXX Not copying anim/actions here? */
 			if (sce_copy->gpd) {
+				id_us_min(&sce_copy->gpd->id);
 				BKE_id_copy_ex(bmain, (ID *)sce_copy->gpd, (ID **)&sce_copy->gpd, 0, false);
 			}
 		}
@@ -430,6 +433,7 @@ Scene *BKE_scene_copy(Main *bmain, Scene *sce, int type)
 		 * are done outside of blenkernel with ED_objects_single_users! */
 
 		/*  camera */
+		/* XXX This is most certainly useless? Object have not yet been duplicated... */
 		if (ELEM(type, SCE_COPY_LINK_DATA, SCE_COPY_FULL)) {
 			ID_NEW_REMAP(sce_copy->camera);
 		}



More information about the Bf-blender-cvs mailing list