From: nds Date: Fri, 17 Apr 2015 15:26:05 +0000 (+0300) Subject: Crash fix: // do not use the given selection if the plane of the sketch has been... X-Git-Tag: V_1.1.0~1^2~2^2~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a69429cf21301106c7bafe60786af0e23fef836c;p=modules%2Fshaper.git Crash fix: // do not use the given selection if the plane of the sketch has been already set. // If this check is absent, a selected plane in the viewer can be set in the sketch // even if the sketch is built on another plane. Scenario: show a plane, create sketch, call a line creation, select a plane in the browser(face is selected in the viewer), abort line creation. Result-modification data model outside the transaction. Reason - the sketch is resumed and the selected face is set as the sketch preselection. --- diff --git a/src/PartSet/PartSet_WidgetSketchLabel.cpp b/src/PartSet/PartSet_WidgetSketchLabel.cpp index 239aeb75a..ceeeb6bff 100644 --- a/src/PartSet/PartSet_WidgetSketchLabel.cpp +++ b/src/PartSet/PartSet_WidgetSketchLabel.cpp @@ -85,6 +85,17 @@ PartSet_WidgetSketchLabel::~PartSet_WidgetSketchLabel() erasePreviewPlanes(); } +bool PartSet_WidgetSketchLabel::setSelection(ModuleBase_ViewerPrs theValue) +{ + // do not use the given selection if the plane of the sketch has been already set. + // If this check is absent, a selected plane in the viewer can be set in the sketch + // even if the sketch is built on another plane. + if (plane().get()) + return true; + + return ModuleBase_WidgetValidated::setSelection(theValue); +} + QList PartSet_WidgetSketchLabel::getControls() const { QList aResult; diff --git a/src/PartSet/PartSet_WidgetSketchLabel.h b/src/PartSet/PartSet_WidgetSketchLabel.h index ab7cd18eb..eea79ea6d 100644 --- a/src/PartSet/PartSet_WidgetSketchLabel.h +++ b/src/PartSet/PartSet_WidgetSketchLabel.h @@ -48,6 +48,13 @@ Q_OBJECT virtual ~PartSet_WidgetSketchLabel(); + /// Set the given wrapped value to the current widget + /// This value should be processed in the widget according to the needs + /// The method is called by the current operation to process the operation preselection. + /// It is redefined to do nothing if the plane of the sketch has been already set. + /// \param theValue the wrapped widget value + virtual bool setSelection(ModuleBase_ViewerPrs theValue); + virtual bool restoreValue() { return true;