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,6 +4022,7 @@ 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); std::shared_lock<std::shared_mutex> rlock(propertiesMutex);
map<string, boost::function<void(std::string)>>::const_iterator itr = set_string_funcs.find(field); map<string, boost::function<void(std::string)>>::const_iterator itr = set_string_funcs.find(field);
if(itr != set_string_funcs.end()) if(itr != set_string_funcs.end())
@ -4029,11 +4030,11 @@ bool Entity::SetInfoStructString(std::string field, std::string value)
(itr->second)(value); (itr->second)(value);
return true; return true;
} }
else { }
RegisterProperty(field); RegisterProperty(field);
SetProperty(field, value); SetProperty(field, value);
} return true;
return false;
} }