diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-11-10 19:10:58 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-11-10 19:10:58 +0300 |
commit | 3346ab034804c0d93e1c20d62e82dff4839b861a (patch) | |
tree | 55cab170fa56d38e3d7aa7c324538043f619ec1c /source/blender/blenkernel/intern | |
parent | c8ef04e7263b7b399683c1d2f8e43f3d720dc810 (diff) |
Fix/workaround T37073: Crash updating custom props visible in the UI
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/idprop.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c index 5c06d5bd86b..23e7778ffd5 100644 --- a/source/blender/blenkernel/intern/idprop.c +++ b/source/blender/blenkernel/intern/idprop.c @@ -571,18 +571,18 @@ void IDP_ReplaceGroupInGroup(IDProperty *dest, const IDProperty *src) * Checks if a property with the same name as prop exists, and if so replaces it. * Use this to preserve order! */ -void IDP_ReplaceInGroup(IDProperty *group, IDProperty *prop) +void IDP_ReplaceInGroup_ex(IDProperty *group, IDProperty *prop, IDProperty *prop_exist) { - IDProperty *loop; - BLI_assert(group->type == IDP_GROUP); - if ((loop = IDP_GetPropertyFromGroup(group, prop->name))) { - BLI_insertlinkafter(&group->data.group, loop, prop); + BLI_assert(prop_exist == IDP_GetPropertyFromGroup(group, prop->name)); + + if ((prop_exist = IDP_GetPropertyFromGroup(group, prop->name))) { + BLI_insertlinkafter(&group->data.group, prop_exist, prop); - BLI_remlink(&group->data.group, loop); - IDP_FreeProperty(loop); - MEM_freeN(loop); + BLI_remlink(&group->data.group, prop_exist); + IDP_FreeProperty(prop_exist); + MEM_freeN(prop_exist); } else { group->len++; @@ -590,6 +590,13 @@ void IDP_ReplaceInGroup(IDProperty *group, IDProperty *prop) } } +void IDP_ReplaceInGroup(IDProperty *group, IDProperty *prop) +{ + IDProperty *prop_exist = IDP_GetPropertyFromGroup(group, prop->name); + + IDP_ReplaceInGroup_ex(group, prop, prop_exist); +} + /** * If a property is missing in \a dest, add it. */ |