Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2014-11-10 19:10:58 +0300
committerCampbell Barton <ideasman42@gmail.com>2014-11-10 19:10:58 +0300
commit3346ab034804c0d93e1c20d62e82dff4839b861a (patch)
tree55cab170fa56d38e3d7aa7c324538043f619ec1c /source/blender/python
parentc8ef04e7263b7b399683c1d2f8e43f3d720dc810 (diff)
Fix/workaround T37073: Crash updating custom props visible in the UI
Diffstat (limited to 'source/blender/python')
-rw-r--r--source/blender/python/generic/idprop_py_api.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/source/blender/python/generic/idprop_py_api.c b/source/blender/python/generic/idprop_py_api.c
index 8c9e84af8ed..d2920df3e69 100644
--- a/source/blender/python/generic/idprop_py_api.c
+++ b/source/blender/python/generic/idprop_py_api.c
@@ -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;