Fix/workaround T37073: Crash updating custom props visible in the UI

This commit is contained in:
2014-11-10 17:10:58 +01:00
parent c8ef04e726
commit 3346ab0348
3 changed files with 32 additions and 9 deletions

View File

@@ -510,7 +510,22 @@ bool BPy_IDProperty_Map_ValidateAndCreate(PyObject *name_obj, IDProperty *group,
MEM_freeN(prop);
}
else {
IDP_ReplaceInGroup(group, prop);
IDProperty *prop_exist;
/* avoid freeing when types match incase they are referenced by the UI, see: T37073
* obviously this isn't a complete solution, but helps for common cases. */
prop_exist = IDP_GetPropertyFromGroup(group, prop->name);
if ((prop_exist != NULL) &&
(prop_exist->type == prop->type) &&
(prop_exist->subtype == prop->subtype))
{
IDP_FreeProperty(prop_exist);
*prop_exist = *prop;
MEM_freeN(prop);
}
else {
IDP_ReplaceInGroup_ex(group, prop, prop_exist);
}
}
return true;