]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #552: Clear variables on document close
authorvsv <vitaly.smetannikov@opencascade.com>
Mon, 25 May 2015 14:37:56 +0000 (17:37 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Mon, 25 May 2015 14:37:56 +0000 (17:37 +0300)
src/Model/Model_Session.cpp
src/PartSet/PartSet_DataTreeModel.h
src/PartSet/PartSet_DocumentDataModel.cpp
src/XGUI/XGUI_Workshop.cpp

index de3cddb282f2560b844528f3ae709c76da93c40a..d5a79927c9eb78537dc0d221989490297776fc4d 100644 (file)
@@ -49,7 +49,7 @@ bool Model_Session::save(const char* theFileName, std::list<std::string>& theRes
 void Model_Session::closeAll()
 {
   Model_Application::getApplication()->deleteAllDocuments();
-  ROOT_DOC->close(true);
+  //ROOT_DOC->close(true);
 }
 
 void Model_Session::startOperation(const std::string& theId)
index ff96baf9b6deb42ce92800a1076806d7fdc51289..0e45f455595c3ed370444894f4c53913b84a1279 100644 (file)
@@ -74,6 +74,10 @@ class PartSet_PartModel : public PartSet_FeaturesModel
       : PartSet_FeaturesModel(theParent)
   {
   }
+  ~PartSet_PartModel()
+  {
+    myPart = FeaturePtr();
+  }
 
   /// Set part id
   /// \param theId a new id
index c4f24582188fc90e13937eb837db889eea873041..bf0eff521bcc92a833f877b5c4be58f8781d6e7a 100644 (file)
@@ -483,6 +483,7 @@ void PartSet_DocumentDataModel::clearSubModels()
   foreach (PartSet_PartModel* aPart, myPartModels) 
     delete aPart;
   myPartModels.clear();
+  myActivePartModel = 0;
 }
 
 ObjectPtr PartSet_DocumentDataModel::object(const QModelIndex& theIndex) const
@@ -546,8 +547,10 @@ void PartSet_DocumentDataModel::removeSubModel(PartSet_PartModel* theModel)
     myIndexes.removeAt(aId);
     aToRemove.removeLast();
   }
-  delete theModel;
+  if (theModel == myActivePartModel)
+    myActivePartModel = 0;
   myPartModels.removeAll(theModel);
+  delete theModel;
 }
 
 
index df417b4d922960e74515de604e8130e49c1ee4ec..dcf348ff61b4b7bf4349e4d8c397fa9c32b5fc95 100644 (file)
@@ -1582,7 +1582,6 @@ void XGUI_Workshop::closeDocument()
 
   SessionPtr aMgr = ModelAPI_Session::get();
   aMgr->closeAll();
-  objectBrowser()->clearContent();
 }
 
 //**************************************************************