keep propertiesMutex only for the initial set attempt, not for Register/SetProperty

This commit is contained in:
Emagi 2025-08-18 15:12:41 -04:00
parent 9162692a9f
commit eb6da37e3b

View File

@ -4022,18 +4022,19 @@ sint64 Entity::GetInfoStructSInt(std::string field)
bool Entity::SetInfoStructString(std::string field, std::string value) bool Entity::SetInfoStructString(std::string field, std::string value)
{ {
std::shared_lock<std::shared_mutex> rlock(propertiesMutex);
map<string, boost::function<void(std::string)>>::const_iterator itr = set_string_funcs.find(field);
if(itr != set_string_funcs.end())
{ {
(itr->second)(value); std::shared_lock<std::shared_mutex> rlock(propertiesMutex);
return true; map<string, boost::function<void(std::string)>>::const_iterator itr = set_string_funcs.find(field);
if(itr != set_string_funcs.end())
{
(itr->second)(value);
return true;
}
} }
else {
RegisterProperty(field); RegisterProperty(field);
SetProperty(field, value); SetProperty(field, value);
} return true;
return false;
} }