Fix crash in recent changes to instancing

Registrable classes already handled their own instancing,
changes to enable instancing everywhere conflicted.
This commit is contained in:
2017-07-27 03:19:12 +10:00
parent 6fe2a48d3e
commit 48e8a1a167

View File

@@ -6660,7 +6660,7 @@ PyObject *pyrna_struct_CreatePyObject(PointerRNA *ptr)
/* New in 2.8x, since not many types support instancing
* we may want to use a flag to avoid looping over all classes. - campbell */
void **instance = RNA_struct_instance(ptr);
void **instance = ptr->data ? RNA_struct_instance(ptr) : NULL;
if (instance && *instance) {
pyrna = *instance;
Py_INCREF(pyrna);
@@ -7466,7 +7466,6 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
PyObject *args;
PyObject *ret = NULL, *py_srna = NULL, *py_class_instance = NULL, *parmitem;
PyTypeObject *py_class;
void **py_class_instance_store = NULL;
PropertyRNA *parm;
ParameterIterator iter;
PointerRNA funcptr;
@@ -7517,10 +7516,6 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
py_class_instance = *instance;
Py_INCREF(py_class_instance);
}
else {
/* store the instance here once its created */
py_class_instance_store = instance;
}
}
}
/* end exception */
@@ -7591,10 +7586,6 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
if (py_class_instance == NULL) {
err = -1; /* so the error is not overridden below */
}
else if (py_class_instance_store) {
*py_class_instance_store = py_class_instance;
Py_INCREF(py_class_instance);
}
}
}