[Bf-blender-cvs] [b2a549b0101] greasepencil-object: Fix memory error for duplicated objects when exit

Antonio Vazquez noreply at git.blender.org
Sat Apr 7 16:10:57 CEST 2018


Commit: b2a549b010160c378f820176058a888b1294479b
Author: Antonio Vazquez
Date:   Sat Apr 7 16:10:49 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rBb2a549b010160c378f820176058a888b1294479b

Fix memory error for duplicated objects when exit

When duplicate an object, the batch cache was pointing to the original address and when close Blender, the pointer was invalid.

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

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

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

diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 154306518d5..ccb95e0e15f 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -780,6 +780,9 @@ void BKE_gpencil_copy_palette_data(bGPdata *gpd_dst, const bGPdata *gpd_src)
  */
 void BKE_gpencil_copy_data(Main *UNUSED(bmain), bGPdata *gpd_dst, const bGPdata *gpd_src, const int UNUSED(flag))
 {
+	/* cache data is not duplicated */
+	gpd_dst->batch_cache_data = NULL;
+
 	/* copy layers */
 	BLI_listbase_clear(&gpd_dst->layers);
 	for (const bGPDlayer *gpl_src = gpd_src->layers.first; gpl_src; gpl_src = gpl_src->next) {



More information about the Bf-blender-cvs mailing list