From 562a00537e3e5ce72fc4e49a5ab2e20ef4022ae6 Mon Sep 17 00:00:00 2001 From: nds Date: Tue, 23 Jun 2015 19:20:27 +0300 Subject: [PATCH] redisplay event should not be flushed during setResult of the feature. Reasons: 1. there are a lot of redisplays for complex feature(sketch fillet) 2. crash in presentations by undo/redo mirror creation, which uses circle(has two results). After first result set, redisplay is emitted, presentation is crashed. --- src/ModelAPI/ModelAPI_Feature.cpp | 8 -------- src/SketcherPrs/SketcherPrs_Mirror.cpp | 12 ------------ src/SketcherPrs/SketcherPrs_Transformation.cpp | 6 ------ 3 files changed, 26 deletions(-) diff --git a/src/ModelAPI/ModelAPI_Feature.cpp b/src/ModelAPI/ModelAPI_Feature.cpp index e29fff7d0..3ba486be3 100644 --- a/src/ModelAPI/ModelAPI_Feature.cpp +++ b/src/ModelAPI/ModelAPI_Feature.cpp @@ -29,7 +29,6 @@ std::shared_ptr ModelAPI_Feature::lastResult() void ModelAPI_Feature::setResult(const std::shared_ptr& theResult) { - static Events_Loop* aLoop = Events_Loop::loop(); static Events_ID EVENT_UPD = Events_Loop::eventByName(EVENT_OBJECT_UPDATED); static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get(); @@ -47,9 +46,6 @@ void ModelAPI_Feature::setResult(const std::shared_ptr& theResu } // in any case result becomes enabled theResult->setDisabled(theResult, false); - // flush vidualisation changes - static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); - aLoop->flush(aRedispEvent); } void ModelAPI_Feature::setResult(const std::shared_ptr& theResult, @@ -65,10 +61,6 @@ void ModelAPI_Feature::setResult(const std::shared_ptr& theResu *aResIter = theResult; } theResult->setDisabled(theResult, false); - // flush visualisation changes - static Events_Loop* aLoop = Events_Loop::loop(); - static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); - aLoop->flush(aRedispEvent); } void ModelAPI_Feature::removeResult(const std::shared_ptr& theResult) diff --git a/src/SketcherPrs/SketcherPrs_Mirror.cpp b/src/SketcherPrs/SketcherPrs_Mirror.cpp index dca445bfd..2c680a64a 100644 --- a/src/SketcherPrs/SketcherPrs_Mirror.cpp +++ b/src/SketcherPrs/SketcherPrs_Mirror.cpp @@ -52,23 +52,11 @@ bool SketcherPrs_Mirror::updatePoints(double theStep) const gp_Pnt aP1; for (i = 0; i < aNb; i++) { aObj = anAttrB->object(i); - if (!aObj.get()) // TODO:empty_result - // this check should be removed here after the result flush is corrected - // the problem is, that feature::execute() flushes redisplay by each result creation - // but it is possible(e.g. in the sketch circle, that there should be more than one result. - // Here, crash happens, because the second result is not created yet - continue; aP1 = aMgr->getPosition(aObj, this, theStep); myPntArray->SetVertice(i + 1, aP1); } for (i = 0; i < aNb; i++) { aObj = anAttrC->object(i); - if (!aObj.get()) // TODO:empty_result - // this check should be removed here after the result flush is corrected - // the problem is, that feature::execute() flushes redisplay by each result creation - // but it is possible(e.g. in the sketch circle, that there should be more than one result. - // Here, crash happens, because the second result is not created yet - continue; aP1 = aMgr->getPosition(aObj, this, theStep); myPntArray->SetVertice(aNb + i + 1, aP1); } diff --git a/src/SketcherPrs/SketcherPrs_Transformation.cpp b/src/SketcherPrs/SketcherPrs_Transformation.cpp index 47f32f7b5..dcbe96667 100644 --- a/src/SketcherPrs/SketcherPrs_Transformation.cpp +++ b/src/SketcherPrs/SketcherPrs_Transformation.cpp @@ -47,12 +47,6 @@ bool SketcherPrs_Transformation::updatePoints(double theStep) const gp_Pnt aP1; for (i = 0; i < aNbB; i++) { aObj = anAttrB->object(i); - if (!aObj.get()) // TODO:empty_result - // this check should be removed here after the result flush is corrected - // the problem is, that feature::execute() flushes redisplay by each result creation - // but it is possible(e.g. in the sketch circle, that there should be more than one result. - // Here, crash happens, because the second result is not created yet - continue; aP1 = aMgr->getPosition(aObj, this, theStep); myPntArray->SetVertice(i + 1, aP1); } -- 2.39.2