Salome HOME
Make compilable on Linux
[modules/shaper.git] / src / Model / Model_AttributeRefList.cpp
index c09190f3326da11cd0057ac0236d4397780762c9..b1fcda04632516822a6a4ae3c9abdbd4d95320dd 100644 (file)
@@ -29,6 +29,7 @@ void Model_AttributeRefList::remove(ObjectPtr theObject)
   if (theObject.get() != NULL) {
     aData = std::dynamic_pointer_cast<Model_Data>(theObject->data());
     myRef->Remove(aData->label().Father());
+    REMOVE_BACK_REF(theObject);
   }
   else { // in case of empty object remove, the first empty object is removed from the list
     std::shared_ptr<Model_Document> aDoc = std::dynamic_pointer_cast<Model_Document>(
@@ -53,6 +54,14 @@ int Model_AttributeRefList::size() const
   return myRef->Extent();
 }
 
+bool Model_AttributeRefList::isInitialized()
+{
+  if (size() == 0) { // empty list is not initialized list: sketch will be not valid after add/undo
+    return false;
+  }
+  return ModelAPI_AttributeRefList::isInitialized();
+}
+
 list<ObjectPtr> Model_AttributeRefList::list()
 {
   std::list<ObjectPtr> aResult;