protect document against nested recomputes
+ convert ObjectStatusLocker into a template class to make its usage more flexible + add status flag 'Recomputing' and set in Document::recompute to detect and avoid nested calls of recompute
This commit is contained in:
@@ -403,9 +403,15 @@ PyObject* DocumentPy::clearUndos(PyObject * args)
|
||||
PyObject* DocumentPy::recompute(PyObject * args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, "")) // convert args: Python->C
|
||||
return NULL; // NULL triggers exception
|
||||
int objectCount = getDocumentPtr()->recompute();
|
||||
return Py::new_reference_to(Py::Int(objectCount));
|
||||
return NULL; // NULL triggers exception
|
||||
try {
|
||||
int objectCount = getDocumentPtr()->recompute();
|
||||
return Py::new_reference_to(Py::Int(objectCount));
|
||||
}
|
||||
catch (const Base::RuntimeError& e) {
|
||||
PyErr_SetString(PyExc_RuntimeError, e.what());
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
PyObject* DocumentPy::getObject(PyObject *args)
|
||||
|
||||
Reference in New Issue
Block a user