Lock m_UserCache whilst iterating over it in UserManagementModule.GetUserData() to avoid concurrency exceptions

user_profiles
Justin Clark-Casey (justincc) 2013-05-21 17:25:06 +01:00
parent e65d1e459e
commit 6ae426c96b
1 changed files with 9 additions and 4 deletions

View File

@ -246,10 +246,15 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
} }
// search the local cache // search the local cache
lock (m_UserCache)
{
foreach (UserData data in m_UserCache.Values) foreach (UserData data in m_UserCache.Values)
{
if (users.Find(delegate(UserData d) { return d.Id == data.Id; }) == null && if (users.Find(delegate(UserData d) { return d.Id == data.Id; }) == null &&
(data.FirstName.ToLower().StartsWith(query.ToLower()) || data.LastName.ToLower().StartsWith(query.ToLower()))) (data.FirstName.ToLower().StartsWith(query.ToLower()) || data.LastName.ToLower().StartsWith(query.ToLower())))
users.Add(data); users.Add(data);
}
}
AddAdditionalUsers(query, users); AddAdditionalUsers(query, users);