From: Artem Zhidkov Date: Fri, 25 Sep 2020 13:23:41 +0000 (+0300) Subject: Issue #20101: SIGSEGV after validating extrusion X-Git-Tag: V9_6_0a1^0 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c940201f2ffcfb713206b47e73cfa105e4aefb29;p=modules%2Fshaper.git Issue #20101: SIGSEGV after validating extrusion Compatibility with old versions of SHAPER documents. --- diff --git a/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp b/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp index ab0d12b7d..0bd58e26c 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp @@ -32,6 +32,8 @@ #include +static const std::string COMPOSITESKETCH_VERSION_1("v9.6"); + static void storeSubShape(const std::shared_ptr 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( + 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); + } } } diff --git a/src/FeaturesPlugin/FeaturesPlugin_Validators.cpp b/src/FeaturesPlugin/FeaturesPlugin_Validators.cpp index 9235d933e..55bad81ce 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Validators.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Validators.cpp @@ -402,7 +402,11 @@ bool FeaturesPlugin_ValidatorBaseForGeneration::isValidAttribute(const Attribute AttributeSelectionListPtr aListAttr = std::dynamic_pointer_cast(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 anApplicableTypes; switch (GeomValidators_ShapeType::shapeType(aSelType)) { case GeomValidators_ShapeType::Vertex: