]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Avoid crash while loading dumped document containing folders
authorazv <azv@opencascade.com>
Sat, 25 Nov 2017 16:17:39 +0000 (19:17 +0300)
committerazv <azv@opencascade.com>
Sat, 25 Nov 2017 16:17:39 +0000 (19:17 +0300)
src/ModelHighAPI/ModelHighAPI_Folder.cpp
src/ModelHighAPI/ModelHighAPI_Folder.h

index cbb986198c057c4f069d7a69a842f970cb33de1b..a4402a5e623cc1413f9ab9571b30d0739b005c47 100644 (file)
@@ -45,8 +45,15 @@ bool ModelHighAPI_Folder::initialize()
     return false;
   }
 
-  SET_ATTRIBUTE(firstFeature, ModelAPI_AttributeReference, ModelAPI_Folder::FIRST_FEATURE_ID());
-  SET_ATTRIBUTE(lastFeature,  ModelAPI_AttributeReference, ModelAPI_Folder::LAST_FEATURE_ID());
+  myFirstFeature = myFolder->reference(ModelAPI_Folder::FIRST_FEATURE_ID());
+  if (!myFirstFeature)
+    return false;
+  myAttrGetter[ModelAPI_Folder::FIRST_FEATURE_ID()] = "firstFeature";
+
+  myLastFeature = myFolder->reference(ModelAPI_Folder::LAST_FEATURE_ID());
+  if (!myLastFeature)
+    return false;
+  myAttrGetter[ModelAPI_Folder::LAST_FEATURE_ID()] = "lastFeature";
 
   return true;
 }
index 6713ff0a04ffc1d49bad6d6e09c0834c9b9ac052..8128df05a2a85b86ec765eda1cbdc08267bbbc05 100644 (file)
@@ -23,7 +23,6 @@
 
 //--------------------------------------------------------------------------------------
 #include <ModelHighAPI_Interface.h>
-#include <ModelHighAPI_Macro.h>
 
 #include <ModelAPI_Folder.h>
 
@@ -51,11 +50,11 @@ public:
 
   /// First feature reference
   std::shared_ptr<ModelAPI_AttributeReference> firstFeature() const
-  { return myfirstFeature; }
+  { return myFirstFeature; }
 
   /// Last feature reference
   std::shared_ptr<ModelAPI_AttributeReference> lastFeature() const
-  { return mylastFeature; }
+  { return myLastFeature; }
 
   /// Dump wrapped feature
   MODELHIGHAPI_EXPORT virtual void dump(ModelHighAPI_Dumper& theDumper) const;
@@ -66,8 +65,8 @@ protected:
 private:
   std::shared_ptr<ModelAPI_Folder> myFolder;
 
-  std::shared_ptr<ModelAPI_AttributeReference> myfirstFeature;
-  std::shared_ptr<ModelAPI_AttributeReference> mylastFeature;
+  std::shared_ptr<ModelAPI_AttributeReference> myFirstFeature;
+  std::shared_ptr<ModelAPI_AttributeReference> myLastFeature;
 };
 
 //--------------------------------------------------------------------------------------