From 9219468b484aa95a8d11e800eb7c7bac588c13a2 Mon Sep 17 00:00:00 2001 From: nds Date: Wed, 18 Nov 2015 18:36:55 +0300 Subject: [PATCH] Re-entrant operation: Horizontal constraint creation. Scenario: create contour, start horizontal constraint, select lines one after another. On the 3rd line, the operation is not restarted anymore. Another scenario corrected: Create a polyline click on vertical constraint click on first segment => V constraint added click on another segment => V constraint added click in the the background (not on a entitity) => Green OK disappear and sometimes the message : Modification of data structure outside of the transaction --- src/PartSet/PartSet_SketcherReetntrantMgr.cpp | 21 ++++++++++++++++++- src/PartSet/PartSet_SketcherReetntrantMgr.h | 1 + 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/PartSet/PartSet_SketcherReetntrantMgr.cpp b/src/PartSet/PartSet_SketcherReetntrantMgr.cpp index 5239265c7..c749c930d 100755 --- a/src/PartSet/PartSet_SketcherReetntrantMgr.cpp +++ b/src/PartSet/PartSet_SketcherReetntrantMgr.cpp @@ -30,7 +30,8 @@ PartSet_SketcherReetntrantMgr::PartSet_SketcherReetntrantMgr(ModuleBase_IWorksho myWorkshop(theWorkshop), myRestartingMode(RM_None), myIsFlagsBlocked(false), - myIsInternalEditOperation(false) + myIsInternalEditOperation(false), + myNoMoreWidgetsAttribute("") { } @@ -176,6 +177,15 @@ void PartSet_SketcherReetntrantMgr::onNoMoreWidgets(const std::string& thePrevio if (!isActiveMgr()) return; + // we should avoid processing of the signal about no more widgets attributes and + // do this after the restart operaion is finished if it was called + // onNoMoreWidgets depends on myIsFlagsBlocked and fill myNoMoreWidgetsAttribute + // if it should be called after restart + if (myIsFlagsBlocked) { + myNoMoreWidgetsAttribute = thePreviousAttributeID; + return; + } + ModuleBase_OperationFeature* aFOperation = dynamic_cast (myWorkshop->currentOperation()); if (!myWorkshop->module()->getFeatureError(aFOperation->feature()).isEmpty()) @@ -339,11 +349,20 @@ void PartSet_SketcherReetntrantMgr::restartOperation() ModuleBase_OperationFeature* aFOperation = dynamic_cast( myWorkshop->currentOperation()); if (aFOperation) { + myNoMoreWidgetsAttribute = ""; myIsFlagsBlocked = true; aFOperation->commit(); module()->launchOperation(aFOperation->id()); myIsFlagsBlocked = false; resetFlags(); + // we should avoid processing of the signal about no more widgets attributes and + // do this after the restart operaion is finished if it was called + // onNoMoreWidgets depends on myIsFlagsBlocked and fill myNoMoreWidgetsAttribute + // if it should be called after restart + if (!myNoMoreWidgetsAttribute.empty()) { + onNoMoreWidgets(myNoMoreWidgetsAttribute); + myNoMoreWidgetsAttribute = ""; + } } } } diff --git a/src/PartSet/PartSet_SketcherReetntrantMgr.h b/src/PartSet/PartSet_SketcherReetntrantMgr.h index 2d76dd637..ebdb0eb16 100755 --- a/src/PartSet/PartSet_SketcherReetntrantMgr.h +++ b/src/PartSet/PartSet_SketcherReetntrantMgr.h @@ -155,6 +155,7 @@ private: FeaturePtr myInternalFeature; QWidget* myInternalWidget; ModuleBase_ModelWidget* myInternalActiveWidget; + std::string myNoMoreWidgetsAttribute; }; #endif -- 2.39.2