App: fix lost of element reference tracking on undo/redo

This commit is contained in:
Zheng, Lei
2022-12-12 10:47:16 +01:00
committed by Uwe
parent a08b04a079
commit 112c15ed75
+11 -8
View File
@@ -1175,9 +1175,10 @@ void PropertyLinkSub::setValue(App::DocumentObject * lValue,
#endif
_pcLinkSub=lValue;
_cSubList=std::move(subs);
if(shadows.size()==_cSubList.size())
if(shadows.size()==_cSubList.size()) {
_ShadowSubList = std::move(shadows);
else
onContainerRestored(); // re-register element references
} else
updateElementReference(nullptr);
checkLabelReferences(_cSubList);
hasSetValue();
@@ -1985,9 +1986,10 @@ void PropertyLinkSubList::setValues(std::vector<DocumentObject*>&& lValue,
aboutToSetValue();
_lValueList = std::move(lValue);
_lSubList = std::move(lSubNames);
if(ShadowSubList.size()==_lSubList.size())
if(ShadowSubList.size()==_lSubList.size()) {
_ShadowSubList = std::move(ShadowSubList);
else
onContainerRestored(); // re-register element references
} else
updateElementReference(nullptr);
checkLabelReferences(_lSubList);
hasSetValue();
@@ -3226,7 +3228,7 @@ void PropertyXLink::detach() {
}
std::string PropertyXLink::getFullName(bool python) const {
if(getName() || python || !parentProp)
if((getName() && getName()[0]) || python || !parentProp)
return inherited::getFullName(python);
std::ostringstream ss;
@@ -3259,13 +3261,14 @@ void PropertyXLink::setSubName(const char *subname)
}
void PropertyXLink::setSubValues(std::vector<std::string> &&subs,
std::vector<ShadowSub> &&shadows)
std::vector<ShadowSub> &&shadows)
{
_SubList = std::move(subs);
_ShadowSubList.clear();
if(shadows.size() == _SubList.size())
if(shadows.size() == _SubList.size()) {
_ShadowSubList = std::move(shadows);
else
onContainerRestored(); // re-register element references
} else
updateElementReference(nullptr);
checkLabelReferences(_SubList);
}