From f00fc09bceb084c9cc79eb28cf037b16a6aba931 Mon Sep 17 00:00:00 2001 From: mpv Date: Mon, 10 Nov 2014 17:22:20 +0300 Subject: [PATCH] Make default validator initializer not global: to be initialized when it is needed --- src/Model/Model_Validator.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Model/Model_Validator.cpp b/src/Model/Model_Validator.cpp index 9db3a3cba..e7750131e 100644 --- a/src/Model/Model_Validator.cpp +++ b/src/Model/Model_Validator.cpp @@ -10,8 +10,6 @@ #include #include -const static std::string kDefaultId = "Model_FeatureValidator"; - void Model_ValidatorsFactory::registerValidator(const std::string& theID, ModelAPI_Validator* theValidator) { @@ -121,6 +119,7 @@ void Model_ValidatorsFactory::validators(const std::string& theFeatureID, Model_ValidatorsFactory::Model_ValidatorsFactory() : ModelAPI_ValidatorsFactory() { + const static std::string kDefaultId = "Model_FeatureValidator"; registerValidator(kDefaultId, new Model_FeatureValidator); } @@ -135,6 +134,7 @@ const ModelAPI_Validator* Model_ValidatorsFactory::validator(const std::string& void Model_ValidatorsFactory::addDefaultValidators(std::list& theValidators) const { + const static std::string kDefaultId = "Model_FeatureValidator"; std::map::const_iterator it = myIDs.find(kDefaultId); if(it == myIDs.end()) return; @@ -143,6 +143,7 @@ void Model_ValidatorsFactory::addDefaultValidators(std::list& theFeature) const { + const static std::string kDefaultId = "Model_FeatureValidator"; // check feature validators first std::map::const_iterator aFeature = myFeatures.find(theFeature->getKind()); @@ -213,6 +214,7 @@ bool Model_ValidatorsFactory::validate(const boost::shared_ptr void Model_ValidatorsFactory::registerNotObligatory(std::string theFeature, std::string theAttribute) { + const static std::string kDefaultId = "Model_FeatureValidator"; std::map::const_iterator it = myIDs.find(kDefaultId); if (it != myIDs.end()) { Model_FeatureValidator* aValidator = dynamic_cast(it->second); -- 2.39.2