Avoid deadlock in NPCModule between DeleteNPC and GetNPC on m_avatars
Signed-off-by: BlueWall <jamesh@bluewallgroup.com>inv-download
parent
28ce323802
commit
b4347cf214
|
@ -398,27 +398,31 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
|||
|
||||
public bool DeleteNPC(UUID agentID, Scene scene)
|
||||
{
|
||||
bool doRemove = false;
|
||||
NPCAvatar av;
|
||||
lock (m_avatars)
|
||||
{
|
||||
NPCAvatar av;
|
||||
if (m_avatars.TryGetValue(agentID, out av))
|
||||
{
|
||||
/*
|
||||
m_log.DebugFormat("[NPC MODULE]: Found {0} {1} to remove",
|
||||
agentID, av.Name);
|
||||
*/
|
||||
doRemove = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (doRemove)
|
||||
{
|
||||
scene.CloseAgent(agentID, false);
|
||||
|
||||
lock (m_avatars)
|
||||
{
|
||||
m_avatars.Remove(agentID);
|
||||
|
||||
/*
|
||||
}
|
||||
m_log.DebugFormat("[NPC MODULE]: Removed NPC {0} {1}",
|
||||
agentID, av.Name);
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
}
|
||||
/*
|
||||
m_log.DebugFormat("[NPC MODULE]: Could not find {0} to remove",
|
||||
agentID);
|
||||
|
|
Loading…
Reference in New Issue