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

@@ -295,16 +295,17 @@ private:
bool _isInOutListRecursive(const DocumentObject *act, const DocumentObject* test, const DocumentObject* checkObj, int depth) const;
};
class AppExport ObjectStatusLocker
template<typename Status, class Object>
class ObjectStatusLocker
{
public:
ObjectStatusLocker(ObjectStatus s, DocumentObject* o) : status(s), obj(o)
ObjectStatusLocker(Status s, Object* o) : status(s), obj(o)
{ obj->setStatus(status, true); }
~ObjectStatusLocker()
{ obj->setStatus(status, false); }
private:
ObjectStatus status;
DocumentObject* obj;
Status status;
Object* obj;
};
} //namespace App