This commit is contained in:
wmayer
2024-11-03 00:05:49 +01:00
parent e523eab001
commit 400d5c49ab
2 changed files with 18 additions and 7 deletions

View File

@@ -3625,9 +3625,10 @@ void Document::_removeObject(DocumentObject* pcObject)
else {
// for a rollback delete the object
signalTransactionRemove(*pcObject, 0);
breakDependency(pcObject, true);
}
breakDependency(pcObject, true);
// remove from map
pcObject->setStatus(ObjectStatus::Remove, false); // Unset the bit to be on the safe side
d->objectIdMap.erase(pcObject->_Id);

View File

@@ -120,7 +120,14 @@ void Document::exportGraphviz(std::ostream& out) const
*/
std::string getId(const DocumentObject * docObj) {
return std::string((docObj)->getDocument()->getName()) + "#" + docObj->getNameInDocument();
std::string id;
if (docObj->isAttachedToDocument()) {
auto doc = docObj->getDocument();
id.append(doc->getName());
id.append("#");
id.append(docObj->getNameInDocument());
}
return id;
}
/**
@@ -437,11 +444,14 @@ void Document::exportGraphviz(std::ostream& out) const
if (obj) {
std::map<std::string,Vertex>::const_iterator item = GlobalVertexList.find(getId(obj));
if (item == GlobalVertexList.end())
add(obj,
std::string(obj->getDocument()->getName()) + "#" + obj->getNameInDocument(),
std::string(obj->getDocument()->getName()) + "#" + obj->Label.getValue(),
CSSubgraphs);
if (item == GlobalVertexList.end()) {
if (obj->isAttachedToDocument()) {
add(obj,
std::string(obj->getDocument()->getName()) + "#" + obj->getNameInDocument(),
std::string(obj->getDocument()->getName()) + "#" + obj->Label.getValue(),
CSSubgraphs);
}
}
}
}
}