From 2039f5bde5c0079337835c88e62109bc7aa610fa Mon Sep 17 00:00:00 2001 From: mpv Date: Tue, 11 Dec 2018 14:37:35 +0300 Subject: [PATCH] Added fix for the non-ASCII string input in parameter name crash. --- src/Model/Model_Update.cpp | 10 +++------- src/ModelAPI/ModelAPI_Expression.cpp | 16 ++++++++++------ 2 files changed, 13 insertions(+), 13 deletions(-) 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; } -- 2.39.2