]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #20101: SIGSEGV after validating extrusion V9_6_0a1
authorArtem Zhidkov <Artem.Zhidkov@opencascade.com>
Fri, 25 Sep 2020 13:23:41 +0000 (16:23 +0300)
committerArtem Zhidkov <Artem.Zhidkov@opencascade.com>
Fri, 25 Sep 2020 13:23:41 +0000 (16:23 +0300)
Compatibility with old versions of SHAPER documents.

src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp
src/FeaturesPlugin/FeaturesPlugin_Validators.cpp

index ab0d12b7dcf130baddc7216f2134834c446a3ef4..0bd58e26cf7755321e1b2c7158e6ea18642b2784 100644 (file)
@@ -32,6 +32,8 @@
 #include <GeomAPI_ShapeExplorer.h>
 
 
+static const std::string COMPOSITESKETCH_VERSION_1("v9.6");
+
 static void storeSubShape(const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
                           ResultBodyPtr theResultBody,
                           const GeomShapePtr theShape,
@@ -49,9 +51,15 @@ void FeaturesPlugin_CompositeSketch::initCompositeSketchAttribtues(const int the
 
   // Initialize selection list.
   if(theInitFlags & InitBaseObjectsList) {
-    data()->addAttribute(BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList::typeId());
+    AttributeSelectionListPtr anObjectsAttr =
+        std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(
+        data()->addAttribute(BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList::typeId()));
     myCurrentSelectionType = selectionList(BASE_OBJECTS_ID())->selectionType();
-    selectionList(BASE_OBJECTS_ID())->setWholeResultAllowed(true);
+    anObjectsAttr->setWholeResultAllowed(true);
+    if (!anObjectsAttr->isInitialized()) {
+      // new feature, specify the version
+      data()->setVersion(COMPOSITESKETCH_VERSION_1);
+    }
   }
 }
 
index 9235d933e78d40e886dc4902e2f84649f016f7e3..55bad81ce443f6772c579ab99f0760d2f362ac78 100644 (file)
@@ -402,7 +402,11 @@ bool FeaturesPlugin_ValidatorBaseForGeneration::isValidAttribute(const Attribute
     AttributeSelectionListPtr aListAttr =
       std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
 
-    const std::string& aSelType = aListAttr->selectionType();
+    const std::string& aVersion = theAttribute->owner()->data()->version();
+    std::string aSelType;
+    if (!aVersion.empty())
+      aSelType = aListAttr->selectionType();
+
     std::list<std::string> anApplicableTypes;
     switch (GeomValidators_ShapeType::shapeType(aSelType)) {
     case GeomValidators_ShapeType::Vertex: