From 55e617293ff16f58590f66fe0111d3a88c636ba6 Mon Sep 17 00:00:00 2001 From: nds Date: Thu, 7 Apr 2016 11:43:56 +0300 Subject: [PATCH] Correction for case: Start Arc, select "2 points type", move mouse in viewer, result: crash(in background mode) --- src/SketchPlugin/SketchPlugin_Arc.cpp | 32 +++++++++++++-------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/SketchPlugin/SketchPlugin_Arc.cpp b/src/SketchPlugin/SketchPlugin_Arc.cpp index c2b9e4ea7..f6d4ec763 100644 --- a/src/SketchPlugin/SketchPlugin_Arc.cpp +++ b/src/SketchPlugin/SketchPlugin_Arc.cpp @@ -241,25 +241,25 @@ AISObjectPtr SketchPlugin_Arc::getAISObject(AISObjectPtr thePrevious) if (aTypeAttr && aTypeAttr->isInitialized() && aTypeAttr->value() == ARC_TYPE_THREE_POINTS() && aEndAttr->isInitialized()) aEndPoint = aSketch->to3D(aEndAttr->x(), aEndAttr->y()); + + std::list > aShapes; + // make a visible point + std::shared_ptr aCenterPointShape = GeomAlgoAPI_PointBuilder::point(aCenter); + aShapes.push_back(aCenterPointShape); + std::shared_ptr aCircleShape = GeomAlgoAPI_EdgeBuilder::lineCircleArc( aCenter, aStartPoint, aEndPoint, aNormal); - if (aCircleShape) { - std::list > aShapes; - // make a visible point - std::shared_ptr aCenterPointShape = GeomAlgoAPI_PointBuilder::point(aCenter); - aShapes.push_back(aCenterPointShape); - + if (aCircleShape) aShapes.push_back(aCircleShape); - if (!aShapes.empty()) - { - std::shared_ptr aCompound = GeomAlgoAPI_CompoundBuilder::compound(aShapes); - AISObjectPtr anAIS = thePrevious; - if (!anAIS) - anAIS = AISObjectPtr(new GeomAPI_AISObject); - anAIS->createShape(aCompound); - anAIS->setWidth(3); - return anAIS; - } + + if (!aShapes.empty()) { + std::shared_ptr aCompound = GeomAlgoAPI_CompoundBuilder::compound(aShapes); + AISObjectPtr anAIS = thePrevious; + if (!anAIS) + anAIS = AISObjectPtr(new GeomAPI_AISObject); + anAIS->createShape(aCompound); + anAIS->setWidth(3); + return anAIS; } } } -- 2.39.2