Extend m_avatars lock in NpcModule.CreateNPC over both creation of NPC scene presence and population of m_avatars.
This is required to stop a race where the SensorRepeat module can detect an NPC avatar before m_avatars is populated. Extending the lock is the easiest to understand solution rather than getting complicated with null checks. Hopefully resolves http://opensimulator.org/mantis/view.php?id=5872iar_mods
parent
6234264211
commit
ce34b359ad
|
@ -140,6 +140,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
// acd.AgentID, i, acd.Appearance.Texture.FaceTextures[i]);
|
// acd.AgentID, i, acd.Appearance.Texture.FaceTextures[i]);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
lock (m_avatars)
|
||||||
|
{
|
||||||
scene.AuthenticateHandler.AddNewCircuit(npcAvatar.CircuitCode, acd);
|
scene.AuthenticateHandler.AddNewCircuit(npcAvatar.CircuitCode, acd);
|
||||||
scene.AddNewClient(npcAvatar, PresenceType.Npc);
|
scene.AddNewClient(npcAvatar, PresenceType.Npc);
|
||||||
|
|
||||||
|
@ -156,8 +158,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
m_log.WarnFormat("[NPC MODULE]: Could not find scene presence for NPC {0} {1}", sp.Name, sp.UUID);
|
m_log.WarnFormat("[NPC MODULE]: Could not find scene presence for NPC {0} {1}", sp.Name, sp.UUID);
|
||||||
}
|
}
|
||||||
|
|
||||||
lock (m_avatars)
|
|
||||||
m_avatars.Add(npcAvatar.AgentId, npcAvatar);
|
m_avatars.Add(npcAvatar.AgentId, npcAvatar);
|
||||||
|
}
|
||||||
|
|
||||||
m_log.DebugFormat("[NPC MODULE]: Created NPC with id {0}", npcAvatar.AgentId);
|
m_log.DebugFormat("[NPC MODULE]: Created NPC with id {0}", npcAvatar.AgentId);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue