[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [42188] trunk/blender/source/blender/ makesrna/intern/rna_rna.c: accessing rna 'default_flag' attribute of a non enum-flag could crash.
Campbell Barton
ideasman42 at gmail.com
Sun Nov 27 15:13:11 CET 2011
Revision: 42188
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42188
Author: campbellbarton
Date: 2011-11-27 14:13:10 +0000 (Sun, 27 Nov 2011)
Log Message:
-----------
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.
Modified Paths:
--------------
trunk/blender/source/blender/makesrna/intern/rna_rna.c
Modified: trunk/blender/source/blender/makesrna/intern/rna_rna.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_rna.c 2011-11-27 14:06:47 UTC (rev 42187)
+++ trunk/blender/source/blender/makesrna/intern/rna_rna.c 2011-11-27 14:13:10 UTC (rev 42188)
@@ -746,7 +746,7 @@
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 @@
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) ||
More information about the Bf-blender-cvs
mailing list