diff --git a/src/App/PropertyLinks.cpp b/src/App/PropertyLinks.cpp index c13e5a3e70..c5c80cbf4c 100644 --- a/src/App/PropertyLinks.cpp +++ b/src/App/PropertyLinks.cpp @@ -1573,6 +1573,7 @@ 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) @@ -2061,6 +2062,7 @@ void PropertyLinkSub::getLinks(std::vector& objs, { if (all || _pcScope != LinkScope::Hidden) { if (_pcLinkSub && _pcLinkSub->isAttachedToDocument()) { + updateElementReferences(_pcLinkSub); objs.push_back(_pcLinkSub); if (subs) { *subs = getSubValues(newStyle); @@ -3132,6 +3134,7 @@ void PropertyLinkSubList::getLinks(std::vector& objs, objs.reserve(objs.size() + _lValueList.size()); for (auto obj : _lValueList) { if (obj && obj->isAttachedToDocument()) { + updateElementReferences(obj); objs.push_back(obj); } } @@ -4067,6 +4070,7 @@ void PropertyXLink::afterRestore() if (!testFlag(LinkRestoreLabel) || !_pcLink || !_pcLink->isAttachedToDocument()) { return; } + setFlag(LinkRestoreLabel, false); for (size_t i = 0; i < _SubList.size(); ++i) { restoreLabelReference(_pcLink, _SubList[i], &_ShadowSubList[i]); @@ -4081,6 +4085,8 @@ void PropertyXLink::onContainerRestored() for (size_t i = 0; i < _SubList.size(); ++i) { _registerElementReference(_pcLink, _SubList[i], _ShadowSubList[i]); } + + updateElementReferences(_pcLink); } void PropertyXLink::updateElementReference(DocumentObject* feature, bool reverse, bool notify) @@ -4633,6 +4639,7 @@ void PropertyXLink::getLinks(std::vector& objs, bool newStyle) const { if ((all || _pcScope != LinkScope::Hidden) && _pcLink && _pcLink->isAttachedToDocument()) { + updateElementReferences(_pcLink, false); objs.push_back(_pcLink); if (subs && _SubList.size() == _ShadowSubList.size()) { *subs = getSubValues(newStyle); @@ -5367,6 +5374,8 @@ void PropertyXLinkSubList::getLinks(std::vector& objs, for (auto& l : _Links) { auto obj = l.getValue(); if (obj && obj->isAttachedToDocument()) { + updateElementReferences(obj); + auto subnames = l.getSubValues(newStyle); if (subnames.empty()) { subnames.emplace_back("");