fix for crash in python matrix utility functions .inverted/adjugated/transposed if the matrix has a read callback and fails.

also replace DM_get_poly_data_layer with dm->getPolyDataArray() since this is the convention in subsurf code and the functions now added.
This commit is contained in:
2012-10-31 03:21:13 +00:00
parent 028d5a64fc
commit e8a70d4b90
2 changed files with 13 additions and 7 deletions

View File

@@ -384,13 +384,19 @@ static PyObject *Matrix_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
static PyObject *matrix__apply_to_copy(PyNoArgsFunction matrix_func, MatrixObject *self)
{
PyObject *ret = Matrix_copy(self);
PyObject *ret_dummy = matrix_func(ret);
if (ret_dummy) {
Py_DECREF(ret_dummy);
return (PyObject *)ret;
if (ret) {
PyObject *ret_dummy = matrix_func(ret);
if (ret_dummy) {
Py_DECREF(ret_dummy);
return (PyObject *)ret;
}
else { /* error */
Py_DECREF(ret);
return NULL;
}
}
else { /* error */
Py_DECREF(ret);
else {
/* copy may fail if the read callback errors out */
return NULL;
}
}