From 16f199bda3aa6a55218be43a9afc953a1e059e55 Mon Sep 17 00:00:00 2001 From: Joseph Eagar Date: Mon, 6 Oct 2008 10:24:32 +0000 Subject: one-liner fix for id property duplication bug --- source/blender/blenkernel/intern/idprop.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c index dd3e34c51e7..f83f66daa85 100644 --- a/source/blender/blenkernel/intern/idprop.c +++ b/source/blender/blenkernel/intern/idprop.c @@ -220,6 +220,10 @@ IDProperty *IDP_CopyGroup(IDProperty *prop) return newp; } +/* + replaces a property with the same name in a group, or adds + it if the propery doesn't exist. +*/ void IDP_ReplaceInGroup(IDProperty *group, IDProperty *prop) { IDProperty *loop; @@ -230,8 +234,7 @@ void IDP_ReplaceInGroup(IDProperty *group, IDProperty *prop) BLI_remlink(&group->data.group, loop); IDP_FreeProperty(loop); - MEM_freeN(loop); - + MEM_freeN(loop); return; } } @@ -263,7 +266,7 @@ int IDP_InsertToGroup(IDProperty *group, IDProperty *previous, IDProperty *pnew) } group->len++; - + BLI_insertlink(&group->data.group, previous, pnew); return 1; } @@ -349,6 +352,7 @@ IDProperty *IDP_GetProperties(ID *id, int create_if_needed) if (create_if_needed) { id->properties = MEM_callocN(sizeof(IDProperty), "IDProperty"); id->properties->type = IDP_GROUP; + strcpy(id->name, "top_level_group"); } return id->properties; } @@ -424,7 +428,7 @@ IDProperty *IDP_New(int type, IDPropertyTemplate val, char *name) return prop; } -/*NOTE: this will free all child properties of list arrays and groups! +/*NOTE: this will free all child properties including list arrays and groups! Also, note that this does NOT unlink anything! Plus it doesn't free the actual IDProperty struct either.*/ void IDP_FreeProperty(IDProperty *prop) @@ -442,7 +446,8 @@ void IDP_FreeProperty(IDProperty *prop) } } -/*Unlinks any IDProperty<->ID linkage that might be going on.*/ +/*Unlinks any IDProperty<->ID linkage that might be going on. + note: currently unused.*/ void IDP_UnlinkProperty(IDProperty *prop) { switch (prop->type) { -- cgit v1.2.3