From fde9ecbfbd40b321cc5d0779d4bb5690419aaaea Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 19 Apr 2011 23:52:14 +0000 Subject: fix [#26967] separate mesh with p crashes blender copying ID properties assumed each property was allocated separately which isnt the case for IDP_Arrays. --- source/blender/blenkernel/intern/idprop.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'source/blender/blenkernel/intern/idprop.c') diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c index 67be3e71101..80962de9730 100644 --- a/source/blender/blenkernel/intern/idprop.c +++ b/source/blender/blenkernel/intern/idprop.c @@ -78,9 +78,12 @@ IDProperty *IDP_NewIDPArray(const char *name) IDProperty *IDP_CopyIDPArray(IDProperty *array) { - IDProperty *narray = MEM_dupallocN(array), *tmp; + /* dont use MEM_dupallocN because this may be part of an array */ + IDProperty *narray = MEM_mallocN(sizeof(IDProperty), "IDP_CopyIDPArray"), *tmp; int i; - + + *narray= *array; + narray->data.pointer = MEM_dupallocN(array->data.pointer); for (i=0; ilen; i++) { /*ok, the copy functions always allocate a new structure, -- cgit v1.2.3