void Model_AttributeRefList::createHash()
{
- if (myHashUsed)
+ if (myHashUsed) {
return;
+ }
eraseHash();
std::shared_ptr<Model_Document> aDoc = std::dynamic_pointer_cast<Model_Document>(
owner()->document());
myHashObjects.insert(anObj);
}
}
- if (!myHashObjects.empty()) // on open document with multi-rotation referenced have no results
- myHashUsed = true;
}
}
/// Returns true if attribute was initialized by some value
MODEL_EXPORT virtual bool isInitialized();
- protected:
+
+ /// Erases the hashed objects caused by complicated modifications in the list
+ void eraseHash();
+
+protected:
/// Objects are created for features automatically
MODEL_EXPORT Model_AttributeRefList(TDF_Label& theLabel);
/// Reinitializes the internal state of the attribute (may be needed on undo/redo, abort, etc)
std::shared_ptr<Model_Document> theDoc) const;
/// Creates the hash-objects containers (does nothing if hash is already correct)
void createHash();
- /// Erases the hashed objects caused by complicated modifications in the list
- void eraseHash();
friend class Model_Data;
};
#include <Model_ResultGroup.h>
#include <Model_ResultField.h>
#include <Model_ResultParameter.h>
+#include <Model_AttributeRefList.h>
#include <ModelAPI_Validator.h>
#include <ModelAPI_CompositeFeature.h>
#include <ModelAPI_Tools.h>
// iterate new list to compare with current
std::set<AttributePtr>::iterator aNewIter = theNewRefs.begin();
for(; aNewIter != theNewRefs.end(); aNewIter++) {
+ // for the Model_AttributeRefList erase cash (issue #2819)
+ std::shared_ptr<Model_AttributeRefList> aRefList =
+ std::dynamic_pointer_cast<Model_AttributeRefList>(*aNewIter);
+ if (aRefList)
+ aRefList->eraseHash();
+
if (aData->refsToMe().find(*aNewIter) == aData->refsToMe().end()) {
FeaturePtr aRefFeat = std::dynamic_pointer_cast<ModelAPI_Feature>((*aNewIter)->owner());
if (aRefFeat)