diff options
author | Ken Hughes <khughes@pacific.edu> | 2006-03-11 04:17:21 +0300 |
---|---|---|
committer | Ken Hughes <khughes@pacific.edu> | 2006-03-11 04:17:21 +0300 |
commit | 04ce5e8efe127b31ec6a551d4aecf164b5937bbc (patch) | |
tree | 727b26af743ab6c72e6b80f032b628af14d7f755 /source | |
parent | 93c3a6f7847c2923b149f76e29546791fa989640 (diff) |
Bugfix: Object.link() was not correctly handling object/datablock material
counting, causing "Error Totblock" messages on exit due to memory not being
freed. Added a call to test_object_materials() after the new data is linked.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/python/api2_2x/Object.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/source/blender/python/api2_2x/Object.c b/source/blender/python/api2_2x/Object.c index c44980a0cad..c8083ff1890 100644 --- a/source/blender/python/api2_2x/Object.c +++ b/source/blender/python/api2_2x/Object.c @@ -1700,12 +1700,7 @@ static PyObject *Object_link( BPy_Object * self, PyObject * args ) } self->object->data = data; - if( self->object->type == OB_MESH ) { - self->object->totcol = 0; - EXPP_synchronizeMaterialLists( self->object ); - } - - //creates the curve for the text object + /* creates the curve for the text object */ if (self->object->type == OB_FONT) text_to_curve(self->object, 0); @@ -1714,10 +1709,14 @@ static PyObject *Object_link( BPy_Object * self, PyObject * args ) if( oldid->us > 0 ) { oldid->us--; } else { - return ( EXPP_ReturnPyObjError( PyExc_RuntimeError, - "old object reference count below 0" ) ); + return EXPP_ReturnPyObjError( PyExc_RuntimeError, + "old object reference count below 0" ); } } + + /* make sure data and object materials are consistent */ + test_object_materials( id ); + return EXPP_incr_ret( Py_None ); } |