From 97ce877883611bb18a389602dc363ecb42aecb4a Mon Sep 17 00:00:00 2001 From: wmayer Date: Sun, 3 Nov 2024 00:05:49 +0100 Subject: [PATCH] Core: Fixes #17553 --- src/App/Document.cpp | 3 ++- src/App/Graphviz.cpp | 22 ++++++++++++++++------ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/App/Document.cpp b/src/App/Document.cpp index c3e3f921d5..49527418e3 100644 --- a/src/App/Document.cpp +++ b/src/App/Document.cpp @@ -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); diff --git a/src/App/Graphviz.cpp b/src/App/Graphviz.cpp index 2971075ef7..567dc0728a 100644 --- a/src/App/Graphviz.cpp +++ b/src/App/Graphviz.cpp @@ -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::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); + } + } } } }