diff options
author | Stephen Swaney <sswaney@centurytel.net> | 2005-05-12 09:45:13 +0400 |
---|---|---|
committer | Stephen Swaney <sswaney@centurytel.net> | 2005-05-12 09:45:13 +0400 |
commit | 55cf304e995ff3e1ed69ff74bf09eee524189b0d (patch) | |
tree | 52a92988bcbb2a19ca4796d080eb309776be38ac /source/blender/python | |
parent | 516e21459c2735ef778f31ebd853f70893d33b2c (diff) |
bugfix: #2254 Curve.appendPoint() gives segfault in PySequence_Check().
Argument tuple not built correctly for CurNurb_appendPointToNurb().
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/api2_2x/CurNurb.c | 7 | ||||
-rw-r--r-- | source/blender/python/api2_2x/Curve.c | 9 |
2 files changed, 13 insertions, 3 deletions
diff --git a/source/blender/python/api2_2x/CurNurb.c b/source/blender/python/api2_2x/CurNurb.c index 81d1de36eec..7dcbf142737 100644 --- a/source/blender/python/api2_2x/CurNurb.c +++ b/source/blender/python/api2_2x/CurNurb.c @@ -400,8 +400,11 @@ PyObject *CurNurb_appendPointToNurb( Nurb * nurb, PyObject * args ) /* do we have a list of four floats or a BezTriple? - */ - PyArg_ParseTuple( args, "O", &pyOb ); + */ + if( !PyArg_ParseTuple( args, "O", &pyOb )) + return( EXPP_ReturnPyObjError + ( PyExc_RuntimeError, + "Internal error parsing arguments" ) ); if( BezTriple_CheckPyObject( pyOb ) ) { BezTriple *tmp; diff --git a/source/blender/python/api2_2x/Curve.c b/source/blender/python/api2_2x/Curve.c index e4d91aca25e..70a4200383d 100644 --- a/source/blender/python/api2_2x/Curve.c +++ b/source/blender/python/api2_2x/Curve.c @@ -1152,6 +1152,8 @@ static PyObject *Curve_appendPoint( BPy_Curve * self, PyObject * args ) int i; int nurb_num; /* index of curve we append to */ PyObject *coord_args; /* coords for new point */ + PyObject *retval = NULL; + PyObject *valtuple; Nurb *nurb = self->curve->nurb.first; /* first nurb in Curve */ /* fixme - need to malloc new Nurb */ @@ -1175,8 +1177,13 @@ static PyObject *Curve_appendPoint( BPy_Curve * self, PyObject * args ) "curve index out of range" ) ); } - return CurNurb_appendPointToNurb( nurb, coord_args ); + /* rebuild our arg tuple for appendPointToNurb() */ + valtuple = Py_BuildValue( "(O)", coord_args ); + + retval = CurNurb_appendPointToNurb( nurb, valtuple ); + Py_DECREF( valtuple ); + return retval; } |