Salome HOME
Crash fix: // do not use the given selection if the plane of the sketch has been...
authornds <natalia.donis@opencascade.com>
Fri, 17 Apr 2015 15:26:05 +0000 (18:26 +0300)
committernds <natalia.donis@opencascade.com>
Fri, 17 Apr 2015 15:26:05 +0000 (18:26 +0300)
 // 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.

src/PartSet/PartSet_WidgetSketchLabel.cpp
src/PartSet/PartSet_WidgetSketchLabel.h

index 239aeb75ad18beec5d7b656c7b4f61110cf63136..ceeeb6bff17f662dd6d2367f90bc9fef00c53374 100644 (file)
@@ -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<QWidget*> PartSet_WidgetSketchLabel::getControls() const
 {
   QList<QWidget*> aResult;
index ab7cd18eb35737396accc48f7e5b4be2a0cb4471..eea79ea6d552119bf2d568384f6fdd64c2647de6 100644 (file)
@@ -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;