diff options
author | Stephen Swaney <sswaney@centurytel.net> | 2007-01-16 07:08:12 +0300 |
---|---|---|
committer | Stephen Swaney <sswaney@centurytel.net> | 2007-01-16 07:08:12 +0300 |
commit | d917157f5952762c2403a86b5db77d20862f4880 (patch) | |
tree | 6c38ed541624b71fada5774668e3e3607555ac44 /source/blender/python/api2_2x/Curve.c | |
parent | dced690915be39592561b889c5e2ba76fd62c371 (diff) |
bugfix: #5581 Joining python created curves crashes Blender
Curve_appendNurb() was incorrectly appending Nurb to Curve
rather than using BLI_addtail().
Diffstat (limited to 'source/blender/python/api2_2x/Curve.c')
-rw-r--r-- | source/blender/python/api2_2x/Curve.c | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/source/blender/python/api2_2x/Curve.c b/source/blender/python/api2_2x/Curve.c index 3dfc18ce755..777d0317c38 100644 --- a/source/blender/python/api2_2x/Curve.c +++ b/source/blender/python/api2_2x/Curve.c @@ -31,6 +31,7 @@ #include "Curve.h" /*This must come first*/ +#include "BLI_blenlib.h" #include "BKE_main.h" #include "BKE_displist.h" #include "BKE_global.h" @@ -329,7 +330,6 @@ PyTypeObject Curve_Type = { /*****************************************************************************/ static PyObject *M_Curve_New( PyObject * self, PyObject * args ) { - char buf[24]; char *name = NULL; BPy_Curve *pycurve; /* for Curve Data object wrapper in Python */ Curve *blcurve = 0; /* for actual Curve Data we create in Blender */ @@ -1153,34 +1153,31 @@ static PyObject *Curve_appendPoint( BPy_Curve * self, PyObject * args ) /**** - appendNurb( new_point ) - create a new nurb in the Curve and add the point param to it. - returns a refernce to the newly created nurb. -*****/ + * + * appendNurb( new_point ) + * + * create a new nurb in the Curve and add the point param to it. + * returns a refernce to the newly created nurb. + * + *****/ static PyObject *Curve_appendNurb( BPy_Curve * self, PyObject * args ) { - Nurb *nurb_ptr = self->curve->nurb.first; - Nurb **pptr = ( Nurb ** ) & ( self->curve->nurb.first ); - Nurb *new_nurb; - + ListBase *nurb_ptr = &(self->curve->nurb); - /* walk to end of nurblist */ - if( nurb_ptr ) { - while( nurb_ptr->next ) { - nurb_ptr = nurb_ptr->next; - } - pptr = &nurb_ptr->next; - } + Nurb *new_nurb; /* malloc new nurb */ new_nurb = ( Nurb * ) MEM_callocN( sizeof( Nurb ), "appendNurb" ); + if( !new_nurb ) return EXPP_ReturnPyObjError ( PyExc_MemoryError, "unable to malloc Nurb" ); if( CurNurb_appendPointToNurb( new_nurb, args ) ) { - *pptr = new_nurb; + // add nurb to curve + BLI_addtail( nurb_ptr, new_nurb); + new_nurb->resolu = self->curve->resolu; new_nurb->resolv = self->curve->resolv; new_nurb->hide = 0; |