Fix missing array duplication when copying material
authorSergey Sharybin <sergey.vfx@gmail.com>
Tue, 20 Mar 2018 10:22:47 +0000 (11:22 +0100)
committerSergey Sharybin <sergey.vfx@gmail.com>
Tue, 20 Mar 2018 10:22:47 +0000 (11:22 +0100)
Texture paint slots were copied as a pointer, causing double-free.

source/blender/blenkernel/intern/material.c

index 0dd7047..01f1662 100644 (file)
@@ -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);
 }