[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [24582] trunk/blender/source/blender/ python/intern/bpy_rna.c: functions returning non ID pointers that relied on having the ID set could crash , (adding a pose constraint crashed in one testcase)
Campbell Barton
ideasman42 at gmail.com
Mon Nov 16 10:20:23 CET 2009
Revision: 24582
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=24582
Author: campbellbarton
Date: 2009-11-16 10:20:21 +0100 (Mon, 16 Nov 2009)
Log Message:
-----------
functions returning non ID pointers that relied on having the ID set could crash, (adding a pose constraint crashed in one testcase)
now use the functions ID pointer.
Modified Paths:
--------------
trunk/blender/source/blender/python/intern/bpy_rna.c
Modified: trunk/blender/source/blender/python/intern/bpy_rna.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy_rna.c 2009-11-16 08:26:47 UTC (rev 24581)
+++ trunk/blender/source/blender/python/intern/bpy_rna.c 2009-11-16 09:20:21 UTC (rev 24582)
@@ -2114,8 +2114,11 @@
if(RNA_struct_is_ID(type)) {
RNA_id_pointer_create(*(void**)data, &newptr);
} else {
- /* XXX this is missing the ID part! */
- RNA_pointer_create(NULL, type, *(void**)data, &newptr);
+ /* note: this is taken from the function's ID pointer
+ * and will break if a function returns a pointer from
+ * another ID block, watch this! - it should at least be
+ * easy to debug since they are all ID's */
+ RNA_pointer_create(ptr->id.data, type, *(void**)data, &newptr);
}
}
@@ -2179,8 +2182,10 @@
return NULL;
}
- /* setup */
- RNA_pointer_create(NULL, &RNA_Function, self_func, &funcptr);
+ /* include the ID pointer for pyrna_param_to_py() so we can include the
+ * ID pointer on return values, this only works when returned values have
+ * the same ID as the functions. */
+ RNA_pointer_create(self_ptr->id.data, &RNA_Function, self_func, &funcptr);
pret= RNA_function_return(self_func);
args_len= PyTuple_GET_SIZE(args);
More information about the Bf-blender-cvs
mailing list