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:
wmayer
2017-07-17 18:24:10 +02:00
parent 9948041175
commit e4770ffa9e
6 changed files with 26 additions and 11 deletions

View File

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