[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45480] trunk/blender/source/blender/ blenkernel: Fix bug [#30863] Array Modifier Start and End Cap cause crash when the Cap Object has vertex group

Nicholas Bishop nicholasbishop at gmail.com
Mon Apr 9 04:14:56 CEST 2012


Revision: 45480
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45480
Author:   nicholasbishop
Date:     2012-04-09 02:14:55 +0000 (Mon, 09 Apr 2012)
Log Message:
-----------
Fix bug [#30863] Array Modifier Start and End Cap cause crash when the Cap Object has vertex group

Another crash with array caps, was caused by not making a deep enough
copy of CD field.

Also fixed the type of the 'mask' parameter, was int where it should
be 64-bit.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/BKE_customdata.h
    trunk/blender/source/blender/blenkernel/intern/customdata.c

Modified: trunk/blender/source/blender/blenkernel/BKE_customdata.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_customdata.h	2012-04-09 01:42:44 UTC (rev 45479)
+++ trunk/blender/source/blender/blenkernel/BKE_customdata.h	2012-04-09 02:14:55 UTC (rev 45480)
@@ -111,7 +111,7 @@
  * then goes through the mesh and makes sure all the customdata blocks are
  * consistent with the new layout.*/
 void CustomData_bmesh_merge(struct CustomData *source, struct CustomData *dest, 
-                            int mask, int alloctype, struct BMesh *bm, const char htype);
+                            CustomDataMask mask, int alloctype, struct BMesh *bm, const char htype);
 
 /* frees data associated with a CustomData object (doesn't free the object
  * itself, though)

Modified: trunk/blender/source/blender/blenkernel/intern/customdata.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/customdata.c	2012-04-09 01:42:44 UTC (rev 45479)
+++ trunk/blender/source/blender/blenkernel/intern/customdata.c	2012-04-09 02:14:55 UTC (rev 45480)
@@ -2156,13 +2156,18 @@
 }
 
 void CustomData_bmesh_merge(CustomData *source, CustomData *dest, 
-                            int mask, int alloctype, BMesh *bm, const char htype)
+                            CustomDataMask mask, int alloctype, BMesh *bm, const char htype)
 {
 	BMHeader *h;
 	BMIter iter;
-	CustomData destold = *dest;
+	CustomData destold;
 	void *tmp;
 	int t;
+
+	/* copy old layer description so that old data can be copied into
+	   the new allocation */
+	destold = *dest;
+	destold.layers = MEM_dupallocN(destold.layers);
 	
 	CustomData_merge(source, dest, mask, alloctype, 0);
 	dest->pool = NULL;




More information about the Bf-blender-cvs mailing list