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

@@ -63,7 +63,7 @@ bool FeaturePythonImp::execute()
Py::Object feature = static_cast<PropertyPythonObject*>(proxy)->getValue();
if (feature.hasAttr(std::string("execute"))) {
if (feature.hasAttr("__object__")) {
ObjectStatusLocker exe(App::PythonCall, object);
ObjectStatusLocker<ObjectStatus, DocumentObject> exe(App::PythonCall, object);
Py::Callable method(feature.getAttr(std::string("execute")));
Py::Tuple args;
Py::Object res = method.apply(args);
@@ -72,7 +72,7 @@ bool FeaturePythonImp::execute()
return true;
}
else {
ObjectStatusLocker exe(App::PythonCall, object);
ObjectStatusLocker<ObjectStatus, DocumentObject> exe(App::PythonCall, object);
Py::Callable method(feature.getAttr(std::string("execute")));
Py::Tuple args(1);
args.setItem(0, Py::Object(object->getPyObject(), true));