[Bf-blender-cvs] [43e0e8defa7] master: Fix (unreported) bloody modifiers messing with ID user count in copy.

Bastien Montagne noreply at git.blender.org
Tue May 8 15:31:06 CEST 2018


Commit: 43e0e8defa71bd3086b8547c848f7686e019e51b
Author: Bastien Montagne
Date:   Tue May 8 15:27:10 2018 +0200
Branches: master
https://developer.blender.org/rB43e0e8defa71bd3086b8547c848f7686e019e51b

Fix (unreported) bloody modifiers messing with ID user count in copy.

User count of IDs is handled by higher-level, generic function,
low-level copydata functions *MUST NOT* touch them anymore, ever!

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

M	source/blender/modifiers/intern/MOD_dynamicpaint.c
M	source/blender/modifiers/intern/MOD_meshsequencecache.c
M	source/blender/modifiers/intern/MOD_uvproject.c

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

diff --git a/source/blender/modifiers/intern/MOD_dynamicpaint.c b/source/blender/modifiers/intern/MOD_dynamicpaint.c
index 9a497acbde1..e7cec312948 100644
--- a/source/blender/modifiers/intern/MOD_dynamicpaint.c
+++ b/source/blender/modifiers/intern/MOD_dynamicpaint.c
@@ -60,15 +60,6 @@ static void copyData(const ModifierData *md, ModifierData *target)
 	DynamicPaintModifierData *tpmd = (DynamicPaintModifierData *)target;
 	
 	dynamicPaint_Modifier_copy(pmd, tpmd);
-
-	if (tpmd->canvas) {
-		for (DynamicPaintSurface *surface = tpmd->canvas->surfaces.first; surface; surface = surface->next) {
-			id_us_plus((ID *)surface->init_texture);
-		}
-	}
-	if (tpmd->brush) {
-		id_us_plus((ID *)tpmd->brush->mat);
-	}
 }
 
 static void freeData(ModifierData *md)
diff --git a/source/blender/modifiers/intern/MOD_meshsequencecache.c b/source/blender/modifiers/intern/MOD_meshsequencecache.c
index e0da66a1734..af3039c50da 100644
--- a/source/blender/modifiers/intern/MOD_meshsequencecache.c
+++ b/source/blender/modifiers/intern/MOD_meshsequencecache.c
@@ -65,9 +65,6 @@ static void copyData(const ModifierData *md, ModifierData *target)
 
 	modifier_copyData_generic(md, target);
 
-	if (tmcmd->cache_file) {
-		id_us_plus(&tmcmd->cache_file->id);
-	}
 	tmcmd->reader = NULL;
 }
 
diff --git a/source/blender/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c
index c0e3b488c2e..6006cd92ec9 100644
--- a/source/blender/modifiers/intern/MOD_uvproject.c
+++ b/source/blender/modifiers/intern/MOD_uvproject.c
@@ -67,18 +67,6 @@ static void initData(ModifierData *md)
 	umd->scalex = umd->scaley = 1.0f;
 }
 
-static void copyData(const ModifierData *md, ModifierData *target)
-{
-#if 0
-	const UVProjectModifierData *umd = (const UVProjectModifierData *) md;
-#endif
-	UVProjectModifierData *tumd = (UVProjectModifierData *) target;
-
-	modifier_copyData_generic(md, target);
-
-	id_us_plus((ID *)tumd->image);
-}
-
 static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED(md))
 {
 	CustomDataMask dataMask = 0;
@@ -370,7 +358,7 @@ ModifierTypeInfo modifierType_UVProject = {
 	                        eModifierTypeFlag_SupportsEditmode |
 	                        eModifierTypeFlag_EnableInEditmode,
 
-	/* copyData */          copyData,
+	/* copyData */          modifier_copyData_generic,
 	/* deformVerts */       NULL,
 	/* deformMatrices */    NULL,
 	/* deformVertsEM */     NULL,



More information about the Bf-blender-cvs mailing list