[Bf-blender-cvs] [48e8a1a1670] blender2.8: Fix crash in recent changes to instancing

Campbell Barton noreply at git.blender.org
Wed Jul 26 19:13:52 CEST 2017


Commit: 48e8a1a1670101a38db5aa10970c4aa938bc9451
Author: Campbell Barton
Date:   Thu Jul 27 03:19:12 2017 +1000
Branches: blender2.8
https://developer.blender.org/rB48e8a1a1670101a38db5aa10970c4aa938bc9451

Fix crash in recent changes to instancing

Registrable classes already handled their own instancing,
changes to enable instancing everywhere conflicted.

===================================================================

M	source/blender/python/intern/bpy_rna.c

===================================================================

diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index 3c3269853df..fcd5441b4e1 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -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);
-			}
 		}
 	}




More information about the Bf-blender-cvs mailing list