diff options
author | Joseph Eagar <joeedh@gmail.com> | 2006-12-01 06:04:36 +0300 |
---|---|---|
committer | Joseph Eagar <joeedh@gmail.com> | 2006-12-01 06:04:36 +0300 |
commit | 71da111613758d289209a5df64f722f8c0926767 (patch) | |
tree | bbd8775f4f68cb9d8c22babf16637bfdc4f44a3e /source/blender/blenkernel | |
parent | b36b940807011e0d85a0030933617ac6d0ec02bb (diff) |
=IDProperties bugfix=
Another bug from the tracker, reported by Mike Stramba.
A duplicated Py_XDECREF in the wrong place made assigning
arrays from Vector objects not work.
Also, fixed nasty bug in C API of idproperties (the function
to look up a property from a group was broken). Fixed a memory
leak too.
In addition, made "del group['property']" delete properties
from group; previously this would just crash (or at least it
should have). Added a small addition to the example in the
epydocs for IDGroup.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_idprop.h | 10 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/idprop.c | 2 |
2 files changed, 11 insertions, 1 deletions
diff --git a/source/blender/blenkernel/BKE_idprop.h b/source/blender/blenkernel/BKE_idprop.h index 0a3e0634411..3a5e84b490e 100644 --- a/source/blender/blenkernel/BKE_idprop.h +++ b/source/blender/blenkernel/BKE_idprop.h @@ -94,7 +94,17 @@ struct. In the future this will just be IDP_FreeProperty and the code will be reorganized to work properly. */ int IDP_AddToGroup(struct IDProperty *group, struct IDProperty *prop); + + +/*NOTE: this does not free the property!! + + To free the property, you have to do: + IDP_FreeProperty(prop); //free all subdata + MEM_freeN(prop); //free property struct itself + +*/ void IDP_RemFromGroup(struct IDProperty *group, struct IDProperty *prop); + IDProperty *IDP_GetPropertyFromGroup(struct IDProperty *prop, char *name); /*Get an iterator to iterate over the members of an id property group. diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c index 90de7edc7bc..0bcb6a87ba3 100644 --- a/source/blender/blenkernel/intern/idprop.c +++ b/source/blender/blenkernel/intern/idprop.c @@ -192,7 +192,7 @@ IDProperty *IDP_GetPropertyFromGroup(IDProperty *prop, char *name) { IDProperty *loop; for (loop=prop->data.group.first; loop; loop=loop->next) { - if (strcmp(prop->name, name)==0) return prop; + if (strcmp(loop->name, name)==0) return loop; } return NULL; } |