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) lock (AvatarName2Key)
{ {
if (purge != myconfig.Security_MasterUsername) lock (AvatarStorageLastUsed)
{ {
if (AvatarStorageLastUsed.ContainsKey(purge) == true) foreach (string purge in PurgeAvatars)
{ {
if(AvatarName2Key.ContainsKey(purge) == true) if (purge != myconfig.Security_MasterUsername)
{ {
AvatarStorageLastUsed.Remove(purge); if (AvatarStorageLastUsed.ContainsKey(purge) == true)
UUID avuuid = AvatarName2Key[purge]; {
AvatarName2Key.Remove(purge); if (AvatarName2Key.ContainsKey(purge) == true)
AvatarKey2Name.Remove(avuuid); {
} 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() public override void ResetAnimations()
{ {
foreach (UUID ani in active_animations) lock (active_animations)
{ {
Client.Self.AnimationStop(ani, true); 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) protected override void AvatarAnimationHandler(object sender, AvatarAnimationEventArgs e)