From: mpv Date: Tue, 11 Dec 2018 11:37:35 +0000 (+0300) Subject: Added fix for the non-ASCII string input in parameter name crash. X-Git-Tag: End2018~81 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=2039f5bde5c0079337835c88e62109bc7aa610fa;p=modules%2Fshaper.git Added fix for the non-ASCII string input in parameter name crash. --- diff --git a/src/Model/Model_Update.cpp b/src/Model/Model_Update.cpp index 45aee1b8a..5e2ccff5f 100755 --- a/src/Model/Model_Update.cpp +++ b/src/Model/Model_Update.cpp @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -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& 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 "<eventID().eventText()<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; } diff --git a/src/ModelAPI/ModelAPI_Expression.cpp b/src/ModelAPI/ModelAPI_Expression.cpp index c0ffdf16d..3bba79c8c 100644 --- a/src/ModelAPI/ModelAPI_Expression.cpp +++ b/src/ModelAPI/ModelAPI_Expression.cpp @@ -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; }