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>2010-09-06 19:54:08 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-09-06 19:54:08 +0400
commit99954545ee23dbeb932add263e94e34ed85c91d5 (patch)
treeb142d81ff22b150f1f12ecf688e75e9da1b2fa01 /source/blender/makesrna/intern/rna_define.c
parentf6c68f10196fd2e7a1831fdfdced6e39ce862e6d (diff)
bugfix [#23656] Problems retrieving properties from inside runtime-created PointerProperties
cant test if this fix solves the problem matt is having but it at least fixes an error caused by classes created in exec(), when the properties pointers were copied the hash key still referred to the python object which could be freed. in most cases this wouldnt happen (would be kept in bytecode) but with exec() the property string is freed immediately.
Diffstat (limited to 'source/blender/makesrna/intern/rna_define.c')
-rw-r--r--source/blender/makesrna/intern/rna_define.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c
index 750b1eef2a9..1fed1663952 100644
--- a/source/blender/makesrna/intern/rna_define.c
+++ b/source/blender/makesrna/intern/rna_define.c
@@ -2617,14 +2617,26 @@ void RNA_def_func_free_pointers(FunctionRNA *func)
}
}
-void RNA_def_property_duplicate_pointers(PropertyRNA *prop)
+void RNA_def_property_duplicate_pointers(StructOrFunctionRNA *cont_, PropertyRNA *prop)
{
+ ContainerRNA *cont= cont_;
EnumPropertyItem *earray;
float *farray;
int *iarray;
int a;
- if(prop->identifier) prop->identifier= BLI_strdup(prop->identifier);
+ /* annoying since we just added this to a hash, could make this add the correct key to the hash in the first place */
+ if(prop->identifier) {
+ if(cont->prophash) {
+ BLI_ghash_remove(cont->prophash, (void*)prop->identifier, NULL, NULL);
+ prop->identifier= BLI_strdup(prop->identifier);
+ BLI_ghash_insert(cont->prophash, (void*)prop->identifier, prop);
+ }
+ else {
+ prop->identifier= BLI_strdup(prop->identifier);
+ }
+ }
+
if(prop->name) prop->name= BLI_strdup(prop->name);
if(prop->description) prop->description= BLI_strdup(prop->description);