[Bf-blender-cvs] [0d5c7e5e36b] master: Fix (unreported) Dynamic Paint modifier not increasing ID usercount in copy function.

Bastien Montagne noreply at git.blender.org
Mon Jun 19 12:41:41 CEST 2017


Commit: 0d5c7e5e36b96176139d8d0d55648e2019a43038
Author: Bastien Montagne
Date:   Mon Jun 19 12:25:41 2017 +0200
Branches: master
https://developer.blender.org/rB0d5c7e5e36b96176139d8d0d55648e2019a43038

Fix (unreported) Dynamic Paint modifier not increasing ID usercount in copy function.

*Sigh* One more example of why we should keep ID management handling in
as few places as possible! It's impossible to keep more than a few
places in sync regarding which ID pointer is refcounted etc.

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

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

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

diff --git a/source/blender/modifiers/intern/MOD_dynamicpaint.c b/source/blender/modifiers/intern/MOD_dynamicpaint.c
index bb75d655802..d54e052e438 100644
--- a/source/blender/modifiers/intern/MOD_dynamicpaint.c
+++ b/source/blender/modifiers/intern/MOD_dynamicpaint.c
@@ -36,6 +36,7 @@
 
 #include "BKE_cdderivedmesh.h"
 #include "BKE_dynamicpaint.h"
+#include "BKE_library.h"
 #include "BKE_library_query.h"
 #include "BKE_modifier.h"
 
@@ -58,6 +59,15 @@ static void copyData(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(surface->init_texture);
+		}
+	}
+	if (tpmd->brush) {
+		id_us_plus(tpmd->brush->mat);
+	}
 }
 
 static void freeData(ModifierData *md)




More information about the Bf-blender-cvs mailing list