Salome HOME
Issue #1112 tab key doesn't work on the last field of left panels
[modules/shaper.git] / src / Model / Model_Document.cpp
index a5598b6a5d5cb28d6e7ce7b006e0447cf198a939..ec071b40300a35ca2d586f902764a204002897ed 100755 (executable)
@@ -295,6 +295,10 @@ void Model_Document::close(const bool theForever)
     mySelectionFeature.reset();
   } else {
     setCurrentFeature(FeaturePtr(), false); // disables all features
+    // update the OB: features are disabled (on remove of Part)
+    Events_Loop* aLoop = Events_Loop::loop();
+    static Events_ID aDeleteEvent = Events_Loop::eventByName(EVENT_OBJECT_DELETED);
+    aLoop->flush(aDeleteEvent);
   }
 
   std::static_pointer_cast<Model_Session>(Model_Session::get())->setCheckTransactions(true);
@@ -577,9 +581,9 @@ void Model_Document::abortOperation()
     if (!myNestedNum.empty())
       (*myNestedNum.rbegin())--;
     // roll back the needed number of transactions
-    // make commit/undo to get the modification delta
     //myDoc->AbortCommand();
-    if (myDoc->CommitCommand()) {
+    // instead of abort, do commit and undo: to get the delta of modifications
+    if (myDoc->CommitCommand())  {
       modifiedLabels(myDoc, aDeltaLabels);
       myDoc->Undo();
     }
@@ -866,6 +870,8 @@ const int Model_Document::index(std::shared_ptr<ModelAPI_Object> theObject)
 
 int Model_Document::size(const std::string& theGroupID)
 {
+  if (myObjs == 0) // may be on close
+    return 0;
   return myObjs->size(theGroupID);
 }