bugfix: #2254 Curve.appendPoint() gives segfault in PySequence_Check().

Argument tuple not built correctly for CurNurb_appendPointToNurb().
This commit is contained in:
Stephen Swaney
2005-05-12 05:45:13 +00:00
parent 516e21459c
commit 55cf304e99
2 changed files with 13 additions and 3 deletions

View File

@@ -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;

View File

@@ -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;
}