From: nds Date: Tue, 4 Apr 2017 09:46:40 +0000 (+0300) Subject: Issue #2067 crash when create circle with start point laying on existing circle ... X-Git-Tag: V_2.7.0~86 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5b3d2643925e5b205ae9856ee7e5e2dd8823ea4c;p=modules%2Fshaper.git Issue #2067 crash when create circle with start point laying on existing circle : reentrant operation that uses circle' center as preselection for a new circle --- diff --git a/src/SketchPlugin/SketchPlugin_MacroCircle.cpp b/src/SketchPlugin/SketchPlugin_MacroCircle.cpp index e0c178ddd..047b5aea8 100644 --- a/src/SketchPlugin/SketchPlugin_MacroCircle.cpp +++ b/src/SketchPlugin/SketchPlugin_MacroCircle.cpp @@ -140,8 +140,19 @@ std::string SketchPlugin_MacroCircle::processEvent( AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast( attribute(aReferenceAttributeName)); if (aRefAttr.get()) { - if (anAttribute.get()) + if (anAttribute.get()) { + if (!anAttribute->owner().get() || !anAttribute->owner()->data()->isValid()) { + FeaturePtr aCreatedFeature = aReentrantMessage->createdFeature(); + if (aCreatedFeature.get()) { + std::string anID = anAttribute->id(); + std::string anArcID; + if (anID == CENTER_POINT_ID()) + anArcID = SketchPlugin_Circle::CENTER_ID(); + anAttribute = aCreatedFeature->attribute(anArcID); + } + } aRefAttr->setAttr(anAttribute); + } else if (anObject.get()) { // if presentation of previous reentrant macro arc is used, the object is invalid, // we should use result of previous feature of the message(Arc) @@ -400,6 +411,11 @@ void SketchPlugin_MacroCircle::attributeChanged(const std::string& theID) { AttributeDoublePtr aRadiusAttr = real(CIRCLE_RADIUS_ID()); bool aWasBlocked = data()->blockSendAttributeUpdated(true); + if(myCenter.get()) { + // center attribute is used in processEvent() to set reference to reentrant arc + std::dynamic_pointer_cast(attribute(CENTER_POINT_ID())) + ->setValue(myCenter); + } aRadiusAttr->setValue(myRadius); data()->blockSendAttributeUpdated(aWasBlocked, false); }