]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #1452 Fatal error when create Distance constraint on construction vertex
authornds <nds@opencascade.com>
Wed, 4 May 2016 12:05:54 +0000 (15:05 +0300)
committernds <nds@opencascade.com>
Wed, 4 May 2016 12:06:19 +0000 (15:06 +0300)
src/ModuleBase/ModuleBase_WidgetValidated.cpp
src/PartSet/PartSet_SketcherMgr.cpp
src/PartSet/PartSet_SketcherMgr.h

index 98ba56f71bffbfd23a8fc8f57795ddc9b95c5f28..390c37793254adfa51fcdd5dd7065f877cad485a 100644 (file)
@@ -163,16 +163,19 @@ bool ModuleBase_WidgetValidated::isValidSelectionForAttribute(const ModuleBase_V
   restoreAttributeValue(theAttribute, aValid);
 
   blockAttribute(theAttribute, false, isFlushesActived, isAttributeSetInitializedBlocked);
+  /// NDS: The following rows are commented for issue #1452 (to be removed after debug)
+  /// This is not correct to perform it here because it might cause update selection and
+  /// the selection mechanizm will be circled: use the scenario of the bug with preselected point.
   // In particular case the results are deleted and called as redisplayed inside of this
   // highlight-selection, to they must be flushed as soon as possible.
   // Example: selection of group-vertices subshapes with shift pressend on body. Without
   //  these 4 lines below the application crashes because of left presentations on
   //  removed results still in the viewer.
-  static Events_ID aDeletedEvent = Events_Loop::eventByName(EVENT_OBJECT_DELETED);
+  /*static Events_ID aDeletedEvent = Events_Loop::eventByName(EVENT_OBJECT_DELETED);
   static Events_ID aRedispEvent = Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY);
   Events_Loop::loop()->flush(aDeletedEvent);
   Events_Loop::loop()->flush(aRedispEvent);
-
+  */
   return aValid;
 }
 
index 51d5043cbf8e96544e3ac9bb3310da0959680627..6b54a5ecd7b8797c4765e884aead3409f563b86b 100755 (executable)
@@ -1030,8 +1030,12 @@ bool PartSet_SketcherMgr::operationActivatedByPreselection()
     bool aCanCommitOperation = true;
     ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
                                                                             (anOperation);
-    if (aFOperation && PartSet_SketcherMgr::isDistanceOperation(aFOperation))
-      aCanCommitOperation = setDistanceValueByPreselection(anOperation, myModule->workshop());
+    if (aFOperation && PartSet_SketcherMgr::isDistanceOperation(aFOperation)) {
+      bool aValueAccepted = setDistanceValueByPreselection(anOperation, myModule->workshop(),
+                                                           aCanCommitOperation);
+      if (!aValueAccepted)
+        return isOperationStopped;
+    }
 
     if (aCanCommitOperation)
       isOperationStopped = anOperation->commit();
@@ -1325,9 +1329,11 @@ void PartSet_SketcherMgr::onPlaneSelected(const std::shared_ptr<GeomAPI_Pln>& th
 }
 
 bool PartSet_SketcherMgr::setDistanceValueByPreselection(ModuleBase_Operation* theOperation,
-                                                         ModuleBase_IWorkshop* theWorkshop)
+                                                         ModuleBase_IWorkshop* theWorkshop,
+                                                         bool& theCanCommitOperation)
 {
   bool isValueAccepted = false;
+  theCanCommitOperation = false;
 
   ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
                                                                               (theOperation);
@@ -1389,6 +1395,7 @@ bool PartSet_SketcherMgr::setDistanceValueByPreselection(ModuleBase_Operation* t
             }
             anEditor->setCursorPosition(aX, anY);
             isValueAccepted = anEditor->showPopupEditor(false);
+            theCanCommitOperation = true;
           }
         }
       }
index 062bd102f2f876701d1ed66fb20dd2f48a18e43b..c739c2852540327f8a4d019cd1b235a46df4a1e8 100644 (file)
@@ -306,7 +306,8 @@ private:
   /// are filled by preseletion
   /// \return true if the value is accepted
   static bool setDistanceValueByPreselection(ModuleBase_Operation* theOperation,
-                                             ModuleBase_IWorkshop* theWorkshop);
+                                             ModuleBase_IWorkshop* theWorkshop,
+                                             bool& theCanCommitOperation);
 
   typedef QMap<FeaturePtr, std::pair<std::set<AttributePtr>, std::set<ResultPtr> > >
                                                                        FeatureToSelectionMap;