From: Artem Zhidkov Date: Thu, 10 Dec 2020 19:37:42 +0000 (+0300) Subject: Issue #20476: sigsegv with offset X-Git-Tag: V9_7_0a1~73 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=1911ccc55cfa86b832fa1ccf021292b34e189b8c;p=modules%2Fshaper.git Issue #20476: sigsegv with offset Crash in Offset algorithm has been eliminated. --- diff --git a/src/SketchPlugin/SketchPlugin_Offset.cpp b/src/SketchPlugin/SketchPlugin_Offset.cpp index 4400e8e61..0412143d0 100644 --- a/src/SketchPlugin/SketchPlugin_Offset.cpp +++ b/src/SketchPlugin/SketchPlugin_Offset.cpp @@ -192,10 +192,15 @@ void SketchPlugin_Offset::execute() std::shared_ptr anOffsetShape( new GeomAlgoAPI_Offset(aPlane, aWireShape, aValue*aSign)); - std::shared_ptr aMakeList(new GeomAlgoAPI_MakeShapeList); - aMakeList->appendAlgo(aWireBuilder); - aMakeList->appendAlgo(anOffsetShape); - anOffsetAlgos.push_back(aMakeList); + if (anOffsetShape->isDone()) { + std::shared_ptr aMakeList(new GeomAlgoAPI_MakeShapeList); + aMakeList->appendAlgo(aWireBuilder); + aMakeList->appendAlgo(anOffsetShape); + anOffsetAlgos.push_back(aMakeList); + } + else { + setError("Offset algorithm failed"); + } } } @@ -633,9 +638,9 @@ void SketchPlugin_Offset::mkBSpline (FeaturePtr& theResult, } else { // non-rational B-spline aWeightsAttr->setSize((int)aWeights.size()); - std::list::iterator anIt = aWeights.begin(); - for (int anIndex = 0; anIt != aWeights.end(); ++anIt, ++anIndex) - aWeightsAttr->setValue(anIndex, *anIt); + std::list::iterator aWIt = aWeights.begin(); + for (int anIndex = 0; aWIt != aWeights.end(); ++aWIt, ++anIndex) + aWeightsAttr->setValue(anIndex, *aWIt); } AttributeDoubleArrayPtr aKnotsAttr =