Salome HOME
Fix for the issue #294 : do not erase internal data structure of document on close...
[modules/shaper.git] / src / Model / Model_Document.cpp
index 915ce9365ee4632265cb39ffe8f201b69b8e2c0b..65d4cb70bb76d66c9d87d07d71f9dcbe82702e46 100644 (file)
@@ -258,9 +258,15 @@ void Model_Document::close(const bool theForever)
     ModelAPI_EventCreator::get()->sendDeleted(aThis, ModelAPI_Feature::group());
     ModelAPI_EventCreator::get()->sendUpdated(aFeature, EVENT_DISP);
     aFeature->eraseResults();
-    aFeature->erase();
+    if (theForever) { // issue #294: do not delete content of the document until it can be redone
+      aFeature->erase();
+    } else {
+      aFeature->data()->execState(ModelAPI_StateMustBeUpdated);
+    }
+  }
+  if (theForever) {
+    myObjs.Clear();
   }
-  myObjs.Clear();
   aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_DELETED));
   aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
 
@@ -461,7 +467,7 @@ void Model_Document::redo()
     subDoc(*aSubIter)->redo();
 }
 
-/// Appenad to the array of references a new referenced label
+/// Append to the array of references a new referenced label
 static void AddToRefArray(TDF_Label& theArrayLab, TDF_Label& theReferenced)
 {
   Handle(TDataStd_ReferenceArray) aRefs;