[Bf-blender-cvs] [46a391b668c] master: Fix missing array duplication when copying material

Sergey Sharybin noreply at git.blender.org
Tue Mar 20 11:30:50 CET 2018


Commit: 46a391b668c19ea3053d117dea67386b13904f78
Author: Sergey Sharybin
Date:   Tue Mar 20 11:22:47 2018 +0100
Branches: master
https://developer.blender.org/rB46a391b668c19ea3053d117dea67386b13904f78

Fix missing array duplication when copying material

Texture paint slots were copied as a pointer, causing double-free.

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

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

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

diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 0dd7047a376..01f16625386 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -256,6 +256,10 @@ void BKE_material_copy_data(Main *bmain, Material *ma_dst, const Material *ma_sr
 		ma_dst->preview = NULL;
 	}
 
+	if (ma_src->texpaintslot != NULL) {
+		ma_dst->texpaintslot = MEM_dupallocN(ma_src->texpaintslot);
+	}
+
 	BLI_listbase_clear(&ma_dst->gpumaterial);
 }



More information about the Bf-blender-cvs mailing list