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>2011-11-27 18:13:10 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-11-27 18:13:10 +0400
commit985e77b723d558fc5aa14b317d18bafbaada3628 (patch)
treed9894581f0c101b4b60e261ada97ca892aa0e8a0 /source/blender/makesrna/intern/rna_rna.c
parent7025f138948d15917fa4e8e469395eaebd32e6b3 (diff)
accessing rna 'default_flag' attribute of a non enum-flag could crash. eg.
bpy.types.Modifier.bl_rna.properties["type"].default_flag now check the default/default_flag match the enum property they are used with.
Diffstat (limited to 'source/blender/makesrna/intern/rna_rna.c')
-rw-r--r--source/blender/makesrna/intern/rna_rna.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c
index 424a08f15cb..940e2e749e3 100644
--- a/source/blender/makesrna/intern/rna_rna.c
+++ b/source/blender/makesrna/intern/rna_rna.c
@@ -746,7 +746,7 @@ static int rna_StringProperty_max_length_get(PointerRNA *ptr)
return ((StringPropertyRNA*)prop)->maxlength;
}
-static EnumPropertyItem *rna_EnumProperty_default_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
+static EnumPropertyItem *rna_EnumProperty_default_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *prop_parent, int *free)
{
PropertyRNA *prop= (PropertyRNA*)ptr->data;
EnumPropertyRNA *eprop;
@@ -754,6 +754,11 @@ static EnumPropertyItem *rna_EnumProperty_default_itemf(bContext *C, PointerRNA
rna_idproperty_check(&prop, ptr);
eprop= (EnumPropertyRNA*)prop;
+ /* incompatible default attributes */
+ if ((prop_parent->flag & PROP_ENUM_FLAG) != (prop->flag & PROP_ENUM_FLAG)) {
+ return NULL;
+ }
+
if( (eprop->itemf == NULL) ||
(eprop->itemf == rna_EnumProperty_default_itemf) ||
(ptr->type == &RNA_EnumProperty) ||