Salome HOME
Fixes for porting to OCCT 7.5.0
authormpv <mpv@opencascade.com>
Thu, 28 Jan 2021 12:47:29 +0000 (15:47 +0300)
committermpv <mpv@opencascade.com>
Thu, 28 Jan 2021 12:47:29 +0000 (15:47 +0300)
src/Model/Model_BodyBuilder.cpp
src/Model/Model_Document.cpp
src/Model/Model_Document.h
src/Model/Model_Objects.h

index 17e0ceddf0e8872d8f08ffd3e1c1f59ae25da272..7c85821a1f21e8c72953d34a4321ba2e66daad4d 100644 (file)
@@ -132,7 +132,7 @@ static bool isShapeInTree(const TDF_Label& theAccess1, const TDF_Label& theAcces
   if (aResult) { //check evolution and a label of this shape
     for(TNaming_SameShapeIterator aShapes(theShape, theAccess1); aShapes.More(); aShapes.Next())
     {
-      static Handle(TNaming_NamedShape) aNS;
+      Handle(TNaming_NamedShape) aNS;
       if (aShapes.Label().FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
         if (aNS->Evolution() != TNaming_SELECTED) {
           theOriginalLabel = aNS->Label();
index 5b68969e887510ec3353e12cbb8d1322aa3d72bc..8fec2926d90a8ddc97e45aa0958d33772b171a12 100644 (file)
@@ -132,6 +132,15 @@ Model_Document::Model_Document(const int theID, const std::string theKind)
   myDoc->CommitCommand();
 }
 
+Model_Document::~Model_Document()
+{
+  if (!myDoc.IsNull())
+  {
+    myDoc->ClearUndos();
+    myDoc->ClearRedos();
+  }
+}
+
 void Model_Document::setThis(DocumentPtr theDoc)
 {
   myObjs->setOwner(theDoc);
@@ -331,6 +340,8 @@ bool Model_Document::load(const char* theDirName, const char* theFileName, Docum
     aSession->setCheckTransactions(false);
     if (myObjs)
       delete myObjs;
+    anOldDoc->ClearRedos();
+    anOldDoc->ClearUndos();
     anOldDoc.Nullify();
     myObjs = new Model_Objects(myDoc->Main()); // synchronization is inside
     myObjs->setOwner(theThis);
index 217e77eeb10df953c55b501aa07e8a4fc82314fe..5cda6ef82dba6528348711e8ea573ba6c19f479b 100644 (file)
@@ -325,6 +325,9 @@ class Model_Document : public ModelAPI_Document
   MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Feature> nextFeature(
     std::shared_ptr<ModelAPI_Feature> theCurrent, const bool theReverse = false) const;
 
+  //! Erases the document structure.
+  ~Model_Document();
+
  protected:
   //! Returns (creates if needed) the general label
   TDF_Label generalLabel() const;
index 3ae6c713a352aa6915b02e7aec17d01e860e5e9e..09b0e208135f56de7dda94cef09744eec3837607 100644 (file)
@@ -27,7 +27,6 @@
 #include <ModelAPI_Result.h>
 #include <ModelAPI_ResultParameter.h>
 
-#include <TDocStd_Document.hxx>
 #include <NCollection_DataMap.hxx>
 #include <TDF_Label.hxx>
 #include <TDF_LabelList.hxx>