Salome HOME
redisplay event should not be flushed during setResult of the feature. Reasons:
authornds <natalia.donis@opencascade.com>
Tue, 23 Jun 2015 16:20:27 +0000 (19:20 +0300)
committernds <natalia.donis@opencascade.com>
Tue, 23 Jun 2015 16:20:27 +0000 (19:20 +0300)
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
src/SketcherPrs/SketcherPrs_Mirror.cpp
src/SketcherPrs/SketcherPrs_Transformation.cpp

index e29fff7d09f69e54a05fef982cc4cd2396f1fbde..3ba486be3b2ba2c4fb1f15fc8f614b8a67e541bd 100644 (file)
@@ -29,7 +29,6 @@ std::shared_ptr<ModelAPI_Result> ModelAPI_Feature::lastResult()
 
 void ModelAPI_Feature::setResult(const std::shared_ptr<ModelAPI_Result>& 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<ModelAPI_Result>& 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<ModelAPI_Result>& theResult,
@@ -65,10 +61,6 @@ void ModelAPI_Feature::setResult(const std::shared_ptr<ModelAPI_Result>& 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<ModelAPI_Result>& theResult)
index dca445bfdac2d94c64b359a0ee203cbef55dbf6b..2c680a64aaf7aae5a882f65c920772e048a3b382 100644 (file)
@@ -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);
   }  
index 47f32f7b550213e411718ed771ad3de8e7a5f604..dcbe96667a82d537539bf8b6d19d67c5d492264b 100644 (file)
@@ -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);
   }