adds some locks to stop threading issues

This commit is contained in:
Madpeterz 2020-12-26 13:38:31 +00:00
parent 03a39741e4
commit 5b58df4f5b
2 changed files with 26 additions and 17 deletions

View file

@ -127,19 +127,25 @@ namespace BSB.bottypes
}
}
}
foreach(string purge in PurgeAvatars)
{
if (purge != myconfig.Security_MasterUsername)
{
if (AvatarStorageLastUsed.ContainsKey(purge) == true)
{
if(AvatarName2Key.ContainsKey(purge) == true)
{
AvatarStorageLastUsed.Remove(purge);
UUID avuuid = AvatarName2Key[purge];
AvatarName2Key.Remove(purge);
AvatarKey2Name.Remove(avuuid);
}
lock (AvatarName2Key)
{
lock (AvatarStorageLastUsed)
{
foreach (string purge in PurgeAvatars)
{
if (purge != myconfig.Security_MasterUsername)
{
if (AvatarStorageLastUsed.ContainsKey(purge) == true)
{
if (AvatarName2Key.ContainsKey(purge) == true)
{
AvatarStorageLastUsed.Remove(purge);
UUID avuuid = AvatarName2Key[purge];
AvatarName2Key.Remove(purge);
AvatarKey2Name.Remove(avuuid);
}
}
}
}
}
}

View file

@ -20,11 +20,14 @@ namespace BSB.bottypes
public override void ResetAnimations()
{
foreach (UUID ani in active_animations)
{
Client.Self.AnimationStop(ani, true);
lock (active_animations)
{
foreach (UUID ani in active_animations)
{
Client.Self.AnimationStop(ani, true);
}
active_animations.Clear();
}
active_animations.Clear();
}
protected override void AvatarAnimationHandler(object sender, AvatarAnimationEventArgs e)