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.
This commit is contained in:
2009-11-16 09:20:21 +00:00
parent 2e104b44c6
commit be07bb3cc3

View File

@@ -2114,8 +2114,11 @@ PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *data)
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 @@ static PyObject * pyrna_func_call(PyObject * self, PyObject *args, PyObject *kw)
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);