Toponaming: Remove updateElementReferences call in PropertyLinkSub (#23263)

* remove updateElementReferences call in PropertyLinkSub

* Retrigger checks

* update element refs after the document has restored
This commit is contained in:
drwho495
2025-08-25 21:39:40 -05:00
committed by GitHub
parent f7f9692c57
commit 3ee1e3335f
3 changed files with 26 additions and 2 deletions

View File

@@ -911,6 +911,7 @@ std::vector<Document*> Application::openDocuments(const std::vector<std::string>
FC_DURATION_LOG(timing.d2, doc.getDocumentName() << " postprocess");
}
FC_TIME_LOG(t,"total");
PropertyLinkBase::updateAllElementReferences();
_isRestoring = false;
signalFinishOpenDocument();

View File

@@ -299,6 +299,27 @@ void PropertyLinkBase::updateElementReferences(DocumentObject* feature, bool rev
}
}
void PropertyLinkBase::updateAllElementReferences(bool reverse)
{
for (auto reference : _ElementRefMap) {
for (auto prop : reference.second) {
if (prop->getContainer()) {
try {
prop->updateElementReference(reference.first, reverse, true);
}
catch (Base::Exception& e) {
e.reportException();
FC_ERR("Failed to update element reference of " << propertyName(prop));
}
catch (std::exception& e) {
FC_ERR("Failed to update element reference of " << propertyName(prop) << ": "
<< e.what());
}
}
}
}
}
void PropertyLinkBase::_registerElementReference(App::DocumentObject* obj,
std::string& sub,
ShadowSub& shadow)
@@ -1573,7 +1594,6 @@ void PropertyLinkSub::onContainerRestored()
for (std::size_t i = 0; i < _cSubList.size(); ++i) {
_registerElementReference(_pcLinkSub, _cSubList[i], _ShadowSubList[i]);
}
updateElementReferences(_pcLinkSub);
}
void PropertyLinkSub::updateElementReference(DocumentObject* feature, bool reverse, bool notify)
@@ -4086,7 +4106,7 @@ void PropertyXLink::onContainerRestored()
_registerElementReference(_pcLink, _SubList[i], _ShadowSubList[i]);
}
updateElementReferences(_pcLink);
// updateElementReferences(_pcLink);
}
void PropertyXLink::updateElementReference(DocumentObject* feature, bool reverse, bool notify)

View File

@@ -385,6 +385,9 @@ public:
/// Update all element references in all link properties of \a feature
static void updateElementReferences(DocumentObject* feature, bool reverse = false);
/// Update all element references in the _ElementRefMap
static void updateAllElementReferences(bool reverse = false);
/// Obtain link properties that contain element references to a given object
static const std::unordered_set<PropertyLinkBase*>& getElementReferences(DocumentObject*);