[Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18226] branches/blender2.5/blender/source /blender: RNA
Campbell Barton
ideasman42 at gmail.com
Thu Jan 8 03:37:12 CET 2009
Im gettiing crashes in the python operator api and traced the problem
back to this commit.
(Even though its crashing in the doc generation It looks like its a
general bug not spesific to python)
the crash is caused by the python api running RNA_property_type on an
operator ACT_OT_keyframes_borderselect property event_type, though Im
not sure the spesific operator has anything todo with it.
To reproduce the crash run this...
./blender -P source/blender/python/epy_doc_gen.py
The bug seems to be that the ID group from....
rna_access.c:123 --- IDProperty *group= rna_idproperties_get(ptr, 0);
has a corrupt pointer, or is corrupt its self
(gdb) p *group
$4 = {next = 0x0, prev = 0x0, type = 0 '\0', subtype = 95 '_', flag =
-18877, name = "����\000\000\000\000\200&�002\000\000\000L#�����\000\000\000\000@&��",
saved = -2, data = {pointer = 0x0, group = {first = 0xb7ee2680, last =
0x2}, val = -1237099892, val2 = -1229955552}, len = 0, totallen =
-1237099744}
(gdb) p group->data
$5 = {pointer = 0x0, group = {first = 0xb7ee2680, last = 0x2}, val =
-1237099892, val2 = -1229955552}
its crashing because group->data.group.last is wrong, I noticed this
value is always 0x2 so its might not an uninitialized pointer?
Ran valgrind and it didnt give any extra useful info.
---------------- backtrace
#0 0xb7aafaa8 in strcmp () from /lib/libc.so.6
#1 0x0847b0ae in rna_idproperty_find (ptr=0xb6b0210c,
name=0x84faf93 "event_type")
at source/blender/makesrna/intern/rna_access.c:128
#2 0x0847b273 in rna_idproperty_check (prop=0xbfc906b4, ptr=0xb6b0210c)
at source/blender/makesrna/intern/rna_access.c:192
#3 0x0847b4af in RNA_property_type (ptr=0xb6b0210c, prop=0xa59ef30)
at source/blender/makesrna/intern/rna_access.c:309
#4 0x0821463f in pyrna_prop_to_py (ptr=0xb6b0210c, prop=0xa59ef30)
at source/blender/python/intern/bpy_rna.c:99
#5 0x08215d4c in pyrna_struct_getattro (self=0xb6b02100, pyname=0xb6b06700)
at source/blender/python/intern/bpy_rna.c:714
#6 0xb7e0310f in PyObject_GetAttr () from /usr/lib/libpython2.6.so.1.0
#7 0xb7e5b14d in builtin_getattr () from /usr/lib/libpython2.6.so.1.0
#8 0xb7e0147d in PyCFunction_Call () from /usr/lib/libpython2.6.so.1.0
#9 0xb7e63a21 in PyEval_EvalFrameEx () from /usr/lib/libpython2.6.so.1.0
#10 0xb7e6432d in PyEval_EvalFrameEx () from /usr/lib/libpython2.6.so.1.0
#11 0xb7e659f0 in PyEval_EvalCodeEx () from /usr/lib/libpython2.6.so.1.0
#12 0xb7e65b53 in PyEval_EvalCode () from /usr/lib/libpython2.6.so.1.0
#13 0xb7e833cd in PyRun_StringFlags () from /usr/lib/libpython2.6.so.1.0
#14 0xb7e62ccc in PyEval_EvalFrameEx () from /usr/lib/libpython2.6.so.1.0
#15 0xb7e659f0 in PyEval_EvalCodeEx () from /usr/lib/libpython2.6.so.1.0
#16 0xb7e65b53 in PyEval_EvalCode () from /usr/lib/libpython2.6.so.1.0
#17 0xb7e833cd in PyRun_StringFlags () from /usr/lib/libpython2.6.so.1.0
#18 0x082142d4 in BPY_run_python_script (C=0xa51a728,
fn=0xbfc91c04 "source/blender/python/epy_doc_gen.py")
at source/blender/python/intern/bpy_interface.c:85
#19 0x080d05ac in main (argc=3, argv=0xbfc91704)
at source/creator/creator.c:688
On Thu, Jan 1, 2009 at 12:44 PM, Brecht Van Lommel <brecht at blender.org> wrote:
> Revision: 18226
> http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18226
> Author: blendix
> Date: 2009-01-01 21:44:40 +0100 (Thu, 01 Jan 2009)
>
> Log Message:
> -----------
> RNA
> * Object has some more properties wrapped, mostly game related.
> * Scene frame changes now send a notifier.
> * Added functions to create/free operator properties for calling
> operators. This also simplifies some duplicated code that did
> this. Ideally though this kind of thing should use the properties
> pointer provided by buttons and keymap items. Example code:
>
> PointerRNA ptr;
>
> WM_operator_properties_create(&ptr, "SOME_OT_name");
> RNA_int_set(&ptr, "value", 42);
> WM_operator_name_call(C, "SOME_OT_name", WM_OP_EXEC_DEFAULT, &ptr);
> WM_operator_properties_free(&ptr);
>
> Modified Paths:
> --------------
> branches/blender2.5/blender/source/blender/editors/interface/interface.c
> branches/blender2.5/blender/source/blender/editors/interface/interface_handlers.c
> branches/blender2.5/blender/source/blender/editors/space_outliner/outliner.c
> branches/blender2.5/blender/source/blender/makesdna/DNA_windowmanager_types.h
> branches/blender2.5/blender/source/blender/makesrna/RNA_access.h
> branches/blender2.5/blender/source/blender/makesrna/intern/rna_access.c
> branches/blender2.5/blender/source/blender/makesrna/intern/rna_constraint.c
> branches/blender2.5/blender/source/blender/makesrna/intern/rna_internal.h
> branches/blender2.5/blender/source/blender/makesrna/intern/rna_modifier.c
> branches/blender2.5/blender/source/blender/makesrna/intern/rna_object.c
> branches/blender2.5/blender/source/blender/makesrna/intern/rna_rna.c
> branches/blender2.5/blender/source/blender/makesrna/intern/rna_scene.c
> branches/blender2.5/blender/source/blender/makesrna/intern/rna_wm.c
> branches/blender2.5/blender/source/blender/python/intern/bpy_operator.c
> branches/blender2.5/blender/source/blender/windowmanager/WM_api.h
> branches/blender2.5/blender/source/blender/windowmanager/intern/wm.c
> branches/blender2.5/blender/source/blender/windowmanager/intern/wm_event_system.c
> branches/blender2.5/blender/source/blender/windowmanager/intern/wm_keymap.c
> branches/blender2.5/blender/source/blender/windowmanager/intern/wm_operators.c
>
> Modified: branches/blender2.5/blender/source/blender/editors/interface/interface.c
> ===================================================================
> --- branches/blender2.5/blender/source/blender/editors/interface/interface.c 2009-01-01 20:31:13 UTC (rev 18225)
> +++ branches/blender2.5/blender/source/blender/editors/interface/interface.c 2009-01-01 20:44:40 UTC (rev 18226)
> @@ -1371,11 +1371,10 @@
>
> static void ui_free_but(const bContext *C, uiBut *but)
> {
> - if(but->opproperties) {
> - IDP_FreeProperty(but->opproperties);
> - MEM_freeN(but->opproperties);
> + if(but->opptr) {
> + WM_operator_properties_free(but->opptr);
> + MEM_freeN(but->opptr);
> }
> - if(but->opptr) MEM_freeN(but->opptr);
> if(but->active) ui_button_active_cancel(C, but);
> if(but->str && but->str != but->strdata) MEM_freeN(but->str);
> ui_free_link(but->link);
> @@ -2610,15 +2609,9 @@
>
> PointerRNA *uiButGetOperatorPtrRNA(uiBut *but)
> {
> - wmOperatorType *ot;
> -
> if(but->opname && !but->opptr) {
> - ot= WM_operatortype_find(but->opname);
> -
> - if(ot) {
> - but->opptr= MEM_callocN(sizeof(PointerRNA), "uiButOpPtr");
> - RNA_pointer_create(NULL, NULL, ot->srna, &but->opproperties, but->opptr);
> - }
> + but->opptr= MEM_callocN(sizeof(PointerRNA), "uiButOpPtr");
> + WM_operator_properties_create(but->opptr, but->opname);
> }
>
> return but->opptr;
>
> Modified: branches/blender2.5/blender/source/blender/editors/interface/interface_handlers.c
> ===================================================================
> --- branches/blender2.5/blender/source/blender/editors/interface/interface_handlers.c 2009-01-01 20:31:13 UTC (rev 18225)
> +++ branches/blender2.5/blender/source/blender/editors/interface/interface_handlers.c 2009-01-01 20:44:40 UTC (rev 18226)
> @@ -147,7 +147,7 @@
>
> const char *opname;
> int opcontext;
> - IDProperty *opproperties;
> + PointerRNA *opptr;
>
> PointerRNA rnapoin;
> PropertyRNA *rnaprop;
> @@ -190,14 +190,14 @@
>
> after->opname= but->opname;
> after->opcontext= but->opcontext;
> - after->opproperties= but->opproperties;
> + after->opptr= but->opptr;
>
> after->rnapoin= but->rnapoin;
> after->rnaprop= but->rnaprop;
>
> but->opname= NULL;
> but->opcontext= 0;
> - but->opproperties= NULL;
> + but->opptr= NULL;
>
> BLI_addtail(&UIAfterFuncs, after);
> }
> @@ -222,10 +222,10 @@
> after->butm_func(C, after->butm_func_arg, after->a2);
>
> if(after->opname)
> - WM_operator_name_call(C, after->opname, after->opcontext, after->opproperties);
> - if(after->opproperties) {
> - IDP_FreeProperty(after->opproperties);
> - MEM_freeN(after->opproperties);
> + WM_operator_name_call(C, after->opname, after->opcontext, after->opptr);
> + if(after->opptr) {
> + WM_operator_properties_free(after->opptr);
> + MEM_freeN(after->opptr);
> }
>
> if(after->rnapoin.data)
>
> Modified: branches/blender2.5/blender/source/blender/editors/space_outliner/outliner.c
> ===================================================================
> --- branches/blender2.5/blender/source/blender/editors/space_outliner/outliner.c 2009-01-01 20:31:13 UTC (rev 18225)
> +++ branches/blender2.5/blender/source/blender/editors/space_outliner/outliner.c 2009-01-01 20:44:40 UTC (rev 18226)
> @@ -1096,7 +1096,7 @@
> te->name= coloritem[index];
> else {
> te->name= MEM_callocN(sizeof(char)*20, "OutlinerRNAArrayName");
> - sprintf(te->name, " %d", index);
> + sprintf(te->name, " %d", index+1);
> te->flag |= TE_FREE_NAME;
> }
> }
> @@ -3227,6 +3227,8 @@
> return ICON_RNA;
> else if(rnatype == &RNA_CollectionProperty)
> return ICON_RNA;
> + else if(rnatype == &RNA_ObjectGameSettings)
> + return ICON_GAME;
> else
> return ICON_DOT;
> }
>
> Modified: branches/blender2.5/blender/source/blender/makesdna/DNA_windowmanager_types.h
> ===================================================================
> --- branches/blender2.5/blender/source/blender/makesdna/DNA_windowmanager_types.h 2009-01-01 20:31:13 UTC (rev 18225)
> +++ branches/blender2.5/blender/source/blender/makesdna/DNA_windowmanager_types.h 2009-01-01 20:44:40 UTC (rev 18226)
> @@ -151,7 +151,6 @@
> struct wmKeymapItem *next, *prev;
>
> char idname[64]; /* used to retrieve operator type pointer */
> - IDProperty *properties; /* default operator properties */
> struct PointerRNA *ptr; /* rna pointer to access properties */
>
> short type; /* event code itself */
>
> Modified: branches/blender2.5/blender/source/blender/makesrna/RNA_access.h
> ===================================================================
> --- branches/blender2.5/blender/source/blender/makesrna/RNA_access.h 2009-01-01 20:31:13 UTC (rev 18225)
> +++ branches/blender2.5/blender/source/blender/makesrna/RNA_access.h 2009-01-01 20:44:40 UTC (rev 18226)
> @@ -143,6 +143,7 @@
> extern StructRNA RNA_NodeTree;
> extern StructRNA RNA_NorController;
> extern StructRNA RNA_Object;
> +extern StructRNA RNA_ObjectGameSettings;
> extern StructRNA RNA_ObstacleFluidSettings;
> extern StructRNA RNA_Operator;
> extern StructRNA RNA_OperatorMousePath;
>
> Modified: branches/blender2.5/blender/source/blender/makesrna/intern/rna_access.c
> ===================================================================
> --- branches/blender2.5/blender/source/blender/makesrna/intern/rna_access.c 2009-01-01 20:31:13 UTC (rev 18225)
> +++ branches/blender2.5/blender/source/blender/makesrna/intern/rna_access.c 2009-01-01 20:44:40 UTC (rev 18226)
> @@ -99,22 +99,20 @@
>
> /* ID Properties */
>
> -IDProperty *rna_idproperties_get(StructRNA *type, void *data, int create)
> +IDProperty *rna_idproperties_get(PointerRNA *ptr, int create)
> {
> - if(type->flag & STRUCT_ID)
> - return IDP_GetProperties(data, create);
> - else if(type == &RNA_IDPropertyGroup || type->from == &RNA_IDPropertyGroup)
> - return data;
> - else if(type->from == &RNA_OperatorProperties) {
> - IDProperty **properties= (IDProperty**)data;
> -
> - if(create && !*properties) {
> + if(ptr->type->flag & STRUCT_ID)
> + return IDP_GetProperties(ptr->data, create);
> + else if(ptr->type == &RNA_IDPropertyGroup || ptr->type->from == &RNA_IDPropertyGroup)
> + return ptr->data;
> + else if(ptr->type->from == &RNA_OperatorProperties) {
> + if(create && !ptr->data) {
> IDPropertyTemplate val;
> val.i = 0; /* silence MSVC warning about uninitialized var when debugging */
> - *properties= IDP_New(IDP_GROUP, val, "RNA_OperatorProperties group");
> + ptr->data= IDP_New(IDP_GROUP, val, "RNA_OperatorProperties group");
> }
>
> - return *properties;
> + return ptr->data;
> }
> else
> return NULL;
> @@ -122,7 +120,7 @@
>
> static IDProperty *rna_idproperty_find(PointerRNA *ptr, const char *name)
> {
> - IDProperty *group= rna_idproperties_get(ptr->type, ptr->data, 0);
> + IDProperty *group= rna_idproperties_get(ptr, 0);
> IDProperty *idprop;
>
> if(group) {
> @@ -194,7 +192,7 @@
> IDProperty *idprop= rna_idproperty_find(ptr, (*prop)->identifier);
>
> if(idprop && !rna_idproperty_verify_valid(*prop, idprop)) {
> - IDProperty *group= rna_idproperties_get(ptr->type, ptr->data, 0);
> + IDProperty *group= rna_idproperties_get(ptr, 0);
>
> IDP_RemFromGroup(group, idprop);
> IDP_FreeProperty(idprop);
> @@ -549,7 +547,7 @@
>
> val.i= value;
>
> - group= rna_idproperties_get(ptr->type, ptr->data, 1);
> + group= rna_idproperties_get(ptr, 1);
> if(group)
> IDP_AddToGroup(group, IDP_New(IDP_INT, val, (char*)prop->identifier));
> }
> @@ -584,7 +582,7 @@
> val.array.len= prop->arraylength;
> val.array.type= IDP_INT;
>
> - group= rna_idproperties_get(ptr->type, ptr->data, 1);
> + group= rna_idproperties_get(ptr, 1);
> if(group) {
> idprop= IDP_New(IDP_ARRAY, val, (char*)prop->identifier);
> IDP_AddToGroup(group, idprop);
> @@ -622,7 +620,7 @@
>
> val.i= value;
>
> - group= rna_idproperties_get(ptr->type, ptr->data, 1);
> + group= rna_idproperties_get(ptr, 1);
> if(group)
> IDP_AddToGroup(group, IDP_New(IDP_INT, val, (char*)prop->identifier));
> }
> @@ -657,7 +655,7 @@
> val.array.len= prop->arraylength;
> val.array.type= IDP_INT;
>
> - group= rna_idproperties_get(ptr->type, ptr->data, 1);
> + group= rna_idproperties_get(ptr, 1);
> if(group) {
> idprop= IDP_New(IDP_ARRAY, val, (char*)prop->identifier);
> IDP_AddToGroup(group, idprop);
> @@ -704,7 +702,7 @@
>
> val.f= value;
>
> - group= rna_idproperties_get(ptr->type, ptr->data, 1);
> + group= rna_idproperties_get(ptr, 1);
> if(group)
> IDP_AddToGroup(group, IDP_New(IDP_FLOAT, val, (char*)prop->identifier));
> }
> @@ -748,7 +746,7 @@
> val.array.len= prop->arraylength;
> val.array.type= IDP_FLOAT;
>
> - group= rna_idproperties_get(ptr->type, ptr->data, 1);
> + group= rna_idproperties_get(ptr, 1);
> if(group) {
> idprop= IDP_New(IDP_ARRAY, val, (char*)prop->identifier);
> IDP_AddToGroup(group, idprop);
> @@ -816,7 +814,7 @@
>
> val.str= (char*)value;
>
> - group= rna_idproperties_get(ptr->type, ptr->data, 1);
> + group= rna_idproperties_get(ptr, 1);
> if(group)
> IDP_AddToGroup(group, IDP_New(IDP_STRING, val, (char*)prop->identifier));
> }
> @@ -852,7 +850,7 @@
>
> val.i= value;
>
> - group= rna_idproperties_get(ptr->type, ptr->data, 1);
> + group= rna_idproperties_get(ptr, 1);
> if(group)
> IDP_AddToGroup(group, IDP_New(IDP_INT, val, (char*)prop->identifier));
> }
> @@ -916,7 +914,7 @@
>
> val.i= 0;
>
> - group= rna_idproperties_get(ptr->type, ptr->data, 1);
> + group= rna_idproperties_get(ptr, 1);
> if(group)
> IDP_AddToGroup(group, IDP_New(IDP_GROUP, val, (char*)prop->identifier));
> }
> @@ -1078,7 +1076,7 @@
> IDPropertyTemplate val;
> val.i= 0;
>
> - group= rna_idproperties_get(ptr->type, ptr->data, 1);
> + group= rna_idproperties_get(ptr, 1);
> if(group) {
> idprop= IDP_NewIDPArray(prop->identifier);
> IDP_AddToGroup(group, idprop);
>
> Modified: branches/blender2.5/blender/source/blender/makesrna/intern/rna_constraint.c
> ===================================================================
> --- branches/blender2.5/blender/source/blender/makesrna/intern/rna_constraint.c 2009-01-01 20:31:13 UTC (rev 18225)
> +++ branches/blender2.5/blender/source/blender/makesrna/intern/rna_constraint.c 2009-01-01 20:44:40 UTC (rev 18226)
> @@ -63,12 +63,12 @@
> {CONSTRAINT_TYPE_CLAMPTO, "CLAMPTO", "Clamp To", ""},
> {CONSTRAINT_TYPE_TRANSFORM, "TRANSFORM", "Transformation", ""},
> {0, NULL, NULL, NULL}};
> - static EnumPropertyItem space_items[] ={
> + /*static EnumPropertyItem space_items[] ={
> {CONSTRAINT_SPACE_WORLD, "WORLD", "World Space", "World/Global space."},
> {CONSTRAINT_SPACE_LOCAL, "LOCAL", "Local", "For objects (relative to parent/without parent influence). | For bones (along normals of bone, without parent/restpositions)."},
>
> @@ Diff output truncated at 10240 characters. @@
>
> _______________________________________________
> Bf-blender-cvs mailing list
> Bf-blender-cvs at blender.org
> http://lists.blender.org/mailman/listinfo/bf-blender-cvs
>
--
- Campbell
More information about the Bf-committers
mailing list