From 5403f92db67b8ee3ee88fe27b93e6daa4adf7287 Mon Sep 17 00:00:00 2001 From: nds Date: Tue, 16 Feb 2016 15:38:51 +0300 Subject: [PATCH] Crash fix in the second study. --- src/PartSet/PartSet_CustomPrs.cpp | 10 ++++++++-- src/PartSet/PartSet_Module.cpp | 5 +++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/PartSet/PartSet_CustomPrs.cpp b/src/PartSet/PartSet_CustomPrs.cpp index 3a0a054c7..31c07ca07 100755 --- a/src/PartSet/PartSet_CustomPrs.cpp +++ b/src/PartSet/PartSet_CustomPrs.cpp @@ -148,8 +148,10 @@ void PartSet_CustomPrs::erasePresentation(const ModuleBase_IModule::ModuleBase_C void PartSet_CustomPrs::clearPresentation(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag) { Handle(PartSet_OperationPrs) anOperationPrs = getPresentation(theFlag); + anOperationPrs->featureShapes().clear(); if (!anOperationPrs.IsNull()) anOperationPrs.Nullify(); + myPresentations[theFlag] = AISObjectPtr(); } Handle(PartSet_OperationPrs) PartSet_CustomPrs::getPresentation( @@ -159,8 +161,10 @@ Handle(PartSet_OperationPrs) PartSet_CustomPrs::getPresentation( if (myPresentations.contains(theFlag)) { AISObjectPtr anOperationPrs = myPresentations[theFlag]; - if (!anOperationPrs.get()) + if (!anOperationPrs.get()) { initPresentation(theFlag); + anOperationPrs = myPresentations[theFlag]; + } Handle(AIS_InteractiveObject) anAISIO = anOperationPrs->impl(); aPresentation = Handle(PartSet_OperationPrs)::DownCast(anAISIO); } @@ -174,7 +178,9 @@ bool PartSet_CustomPrs::redisplay(const ObjectPtr& theObject, #ifdef DO_NOT_VISUALIZE_CUSTOM_PRESENTATION return false; #endif - bool aRedisplayed = displayPresentation(theFlag, theUpdateViewer); + bool aRedisplayed = false; + if (myIsActive[theFlag]) + aRedisplayed = displayPresentation(theFlag, theUpdateViewer); return aRedisplayed; } diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 641d17ac2..cf5c2c743 100755 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -296,8 +296,9 @@ void PartSet_Module::operationResumed(ModuleBase_Operation* theOperation) void PartSet_Module::operationStopped(ModuleBase_Operation* theOperation) { - bool isModified = myCustomPrs->deactivate(ModuleBase_IModule::CustomizeArguments, false) || - myCustomPrs->deactivate(ModuleBase_IModule::CustomizeResults, false); + bool isModifiedArgs = myCustomPrs->deactivate(ModuleBase_IModule::CustomizeArguments, false); + bool isModifiedResults = myCustomPrs->deactivate(ModuleBase_IModule::CustomizeResults, false); + bool isModified = isModifiedArgs || isModifiedResults; if (PartSet_SketcherMgr::isNestedSketchOperation(theOperation)) { mySketchMgr->stopNestedSketch(theOperation); -- 2.39.2