Salome HOME
Merge branch 'Dev_1.1.0' of newgeom:newgeom into Dev_1.1.0
[modules/shaper.git] / src / Model / Model_AttributeRefList.cpp
index effa56db232cb21a0989fc801baad662fcf283a1..c9722835887b00258b8e1acbac9797dac0dd06c1 100644 (file)
@@ -16,6 +16,12 @@ void Model_AttributeRefList::append(ObjectPtr theObject)
 {
   std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(theObject->data());
   myRef->Append(aData->label().Father());  // store label of the object
+  // do it before the transaction finish to make just created/removed objects know dependencies
+  // and reference from composite feature is removed automatically
+  FeaturePtr anOwnerFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(owner());
+  if (anOwnerFeature.get()) {
+    aData->addBackReference(anOwnerFeature, id());
+  }
 
   owner()->data()->sendAttributeUpdated(this);
 }