]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix for 671: if it is not case, do not use it as reference to objects
authormpv <mpv@opencascade.com>
Fri, 3 Jul 2015 13:40:52 +0000 (16:40 +0300)
committermpv <mpv@opencascade.com>
Fri, 3 Jul 2015 13:40:52 +0000 (16:40 +0300)
src/Model/Model_Data.cpp

index 36f01202816dbde5185156484f15d7f882539882..347a21820bcdf626163460c6593d4e3c1f77915a 100644 (file)
@@ -378,12 +378,22 @@ void Model_Data::updateConcealmentFlag()
   }
 }
 
+#include <Model_Validator.h>
+
 void Model_Data::referencesToObjects(
   std::list<std::pair<std::string, std::list<ObjectPtr> > >& theRefs)
 {
+  static Model_ValidatorsFactory* aValidators = 
+    static_cast<Model_ValidatorsFactory*>(ModelAPI_Session::get()->validators());
+  FeaturePtr aMyFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(myObject);
+
   std::map<std::string, std::shared_ptr<ModelAPI_Attribute> >::iterator anAttr = myAttrs.begin();
   std::list<ObjectPtr> aReferenced; // not inside of cycle to avoid excess memory menagement
   for(; anAttr != myAttrs.end(); anAttr++) {
+    // skip not-case attributres, that really may refer to anything not-used (issue 671)
+    if (aMyFeature.get() && !aValidators->isCase(aMyFeature, anAttr->second->id()))
+      continue;
+
     std::string aType = anAttr->second->attributeType();
     if (aType == ModelAPI_AttributeReference::typeId()) { // reference to object
       std::shared_ptr<ModelAPI_AttributeReference> aRef = std::dynamic_pointer_cast<