0003279: Error 'invalid DAG' after deleting sketch using expressions

This commit is contained in:
wmayer
2018-01-31 00:27:38 +01:00
parent 70399e6c9c
commit 114cdc6822
3 changed files with 51 additions and 0 deletions

View File

@@ -2867,6 +2867,9 @@ void Document::_removeObject(DocumentObject* pcObject)
void Document::breakDependency(DocumentObject* pcObject, bool clear)
{
// Nullify all dependent objects
std::vector<DocumentObject *> docObjs;
pcObject->ExpressionEngine.getDocumentObjectDeps(docObjs);
for (std::map<std::string,DocumentObject*>::iterator it = d->objectMap.begin(); it != d->objectMap.end(); ++it) {
std::map<std::string,App::Property*> Map;
it->second->getPropertyMap(Map);
@@ -2929,6 +2932,14 @@ void Document::breakDependency(DocumentObject* pcObject, bool clear)
}
}
}
if (std::find(docObjs.begin(), docObjs.end(), it->second) != docObjs.end()) {
std::vector<App::ObjectIdentifier> paths;
pcObject->ExpressionEngine.getPathsToDocumentObject(it->second, paths);
for (std::vector<App::ObjectIdentifier>::iterator jt = paths.begin(); jt != paths.end(); ++jt) {
pcObject->ExpressionEngine.setValue(*jt, nullptr);
}
}
}
}