]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Added fix for the non-ASCII string input in parameter name crash.
authormpv <mpv@opencascade.com>
Tue, 11 Dec 2018 11:37:35 +0000 (14:37 +0300)
committermpv <mpv@opencascade.com>
Tue, 11 Dec 2018 11:38:05 +0000 (14:38 +0300)
src/Model/Model_Update.cpp
src/ModelAPI/ModelAPI_Expression.cpp

index 45aee1b8a7b7df33eb6e0ab6403c2efd87ccbb5a..5e2ccff5f8726e77de59cbef4692acd2857e95ad 100755 (executable)
@@ -40,6 +40,7 @@
 #include <ModelAPI_Tools.h>
 #include <ModelAPI_ResultBody.h>
 #include <ModelAPI_ResultPart.h>
+#include <ModelAPI_ResultConstruction.h>
 #include <GeomAPI_Shape.h>
 #include <GeomDataAPI_Point.h>
 #include <GeomDataAPI_Point2D.h>
@@ -76,10 +77,6 @@ Model_Update::Model_Update()
   aLoop->registerListener(this, kReorderEvent);
   static const Events_ID kUpdatedSel = aLoop->eventByName(EVENT_UPDATE_SELECTION);
   aLoop->registerListener(this, kUpdatedSel);
-  static const Events_ID kAutomaticOff = aLoop->eventByName(EVENT_AUTOMATIC_RECOMPUTATION_DISABLE);
-  aLoop->registerListener(this, kAutomaticOff);
-  static const Events_ID kAutomaticOn = aLoop->eventByName(EVENT_AUTOMATIC_RECOMPUTATION_ENABLE);
-  aLoop->registerListener(this, kAutomaticOn);
 
   //  Config_PropManager::findProp("Model update", "automatic_rebuild")->value() == "true";
   myIsParamUpdated = false;
@@ -240,8 +237,6 @@ void Model_Update::processEvent(const std::shared_ptr<Events_Message>& theMessag
   static const Events_ID kReorderEvent = aLoop->eventByName(EVENT_ORDER_UPDATED);
   static const Events_ID kRedisplayEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
   static const Events_ID kUpdatedSel = aLoop->eventByName(EVENT_UPDATE_SELECTION);
-  static const Events_ID kAutomaticOff = aLoop->eventByName(EVENT_AUTOMATIC_RECOMPUTATION_DISABLE);
-  static const Events_ID kAutomaticOn = aLoop->eventByName(EVENT_AUTOMATIC_RECOMPUTATION_ENABLE);
 
 #ifdef DEB_UPDATE
   std::cout<<"****** Event "<<theMessage->eventID().eventText()<<std::endl;
@@ -714,7 +709,8 @@ bool Model_Update::processFeature(FeaturePtr theFeature)
           aDoExecute = true;
         } else if (theFeature->results().size()) { // execute only not-results features
           aDoExecute = !(theFeature->firstResult()->groupName() == ModelAPI_ResultBody::group() ||
-                         theFeature->firstResult()->groupName() == ModelAPI_ResultPart::group());
+            theFeature->firstResult()->groupName() == ModelAPI_ResultPart::group() ||
+            theFeature->getKind() == "Sketch");
         } else {
           aDoExecute = aState != ModelAPI_StateInvalidArgument;
         }
index c0ffdf16d67b6061157d3c22df960ab129b1e1c2..3bba79c8c12108e9b0a1dda75baae3ee7a6640e0 100644 (file)
@@ -54,14 +54,18 @@ bool ModelAPI_Expression::isVariable(const std::string& theString)
 {
   if (theString.empty())
     return false;
-  std::string::const_iterator it = theString.begin();
-  if (!(isalpha(*it) || (*it) == '_') || it == theString.end())
-    return false;
-  it++;
-  for ( ; it != theString.end(); ++it ) {
-    if(!(isalnum(*it) || (*it) == '_')) {
+  try {
+    std::string::const_iterator it = theString.begin();
+    if (!(isalpha(*it) || (*it) == '_') || it == theString.end())
       return false;
+    it++;
+    for ( ; it != theString.end(); ++it ) {
+      if(!(isalnum(*it) || (*it) == '_')) {
+        return false;
+      }
     }
+  } catch(...) {
+    return false;
   }
   return true;
 }