From 0deea3edf631c5db519995958bcfd2e25d2fd04a Mon Sep 17 00:00:00 2001 From: vsv Date: Wed, 24 Oct 2018 16:17:58 +0300 Subject: [PATCH] Issue #2715: Make update of Object Browser only after operation finished --- src/ModuleBase/ModuleBase_OperationFeature.cpp | 8 ++++---- src/SketchPlugin/SketchPlugin_SketchEntity.h | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/ModuleBase/ModuleBase_OperationFeature.cpp b/src/ModuleBase/ModuleBase_OperationFeature.cpp index 5ec2646d2..a1346ebc8 100755 --- a/src/ModuleBase/ModuleBase_OperationFeature.cpp +++ b/src/ModuleBase/ModuleBase_OperationFeature.cpp @@ -355,13 +355,13 @@ bool ModuleBase_OperationFeature::commit() commitOperation(); stopOperation(); - emit stopped(); - emit committed(); - // finishOperation has to be after commited because in signal commited - // there is a modification of attribures (color) SessionPtr aMgr = ModelAPI_Session::get(); aMgr->finishOperation(); + // Finish operation has to be before stopped because stopped caused update of Object browser + // If it will be done before of cleaning of obsolete objects it will cause crash + emit stopped(); + emit committed(); afterCommitOperation(); #ifdef DEBUG_OPERATION_START diff --git a/src/SketchPlugin/SketchPlugin_SketchEntity.h b/src/SketchPlugin/SketchPlugin_SketchEntity.h index 78a0429d7..baa37b9d8 100644 --- a/src/SketchPlugin/SketchPlugin_SketchEntity.h +++ b/src/SketchPlugin/SketchPlugin_SketchEntity.h @@ -25,6 +25,7 @@ #include "SketchPlugin_Feature.h" #include +#include #include #include #include @@ -152,7 +153,7 @@ class SketchPlugin_SketchEntity : public SketchPlugin_Feature, public GeomAPI_IC aColor = Config_PropManager::color("Visualization", "sketch_entity_color"); } if (!aColor.empty()) { - if (theResult.get()) { + if (theResult.get() && ModelAPI_Session::get()->isOperation()) { AttributeIntArrayPtr aColorAttr = theResult->data()->intArray(ModelAPI_Result::COLOR_ID()); aColorAttr->setSize(3); // Set the color attribute in order do not use default colors in the perasentation object -- 2.39.2