aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
diff options
context:
space:
mode:
authortglion2015-04-18 09:04:33 +0200
committerBlueWall2015-04-18 08:08:33 -0500
commitb4347cf214b74cafb2a9f8804eef21d44c4ebdee (patch)
tree1cb3f7d6481b2dcdec6f36b820bcbcb895a80ff4 /OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
parentEnable grab feature (Ctrl+Drag) for non-physical link-sets and add code to ha... (diff)
downloadopensim-SC-b4347cf214b74cafb2a9f8804eef21d44c4ebdee.zip
opensim-SC-b4347cf214b74cafb2a9f8804eef21d44c4ebdee.tar.gz
opensim-SC-b4347cf214b74cafb2a9f8804eef21d44c4ebdee.tar.bz2
opensim-SC-b4347cf214b74cafb2a9f8804eef21d44c4ebdee.tar.xz
Avoid deadlock in NPCModule between DeleteNPC and GetNPC on m_avatars
Signed-off-by: BlueWall <jamesh@bluewallgroup.com>
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs24
1 files changed, 14 insertions, 10 deletions
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index b834619..9232db9 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -398,26 +398,30 @@ namespace OpenSim.Region.OptionalModules.World.NPC
398 398
399 public bool DeleteNPC(UUID agentID, Scene scene) 399 public bool DeleteNPC(UUID agentID, Scene scene)
400 { 400 {
401 bool doRemove = false;
402 NPCAvatar av;
401 lock (m_avatars) 403 lock (m_avatars)
402 { 404 {
403 NPCAvatar av;
404 if (m_avatars.TryGetValue(agentID, out av)) 405 if (m_avatars.TryGetValue(agentID, out av))
405 { 406 {
406 /* 407 /*
407 m_log.DebugFormat("[NPC MODULE]: Found {0} {1} to remove", 408 m_log.DebugFormat("[NPC MODULE]: Found {0} {1} to remove",
408 agentID, av.Name); 409 agentID, av.Name);
409 */ 410 */
411 doRemove = true;
412 }
413 }
410 414
411 scene.CloseAgent(agentID, false); 415 if (doRemove)
412 416 {
417 scene.CloseAgent(agentID, false);
418 lock (m_avatars)
419 {
413 m_avatars.Remove(agentID); 420 m_avatars.Remove(agentID);
414
415 /*
416 m_log.DebugFormat("[NPC MODULE]: Removed NPC {0} {1}",
417 agentID, av.Name);
418 */
419 return true;
420 } 421 }
422 m_log.DebugFormat("[NPC MODULE]: Removed NPC {0} {1}",
423 agentID, av.Name);
424 return true;
421 } 425 }
422 /* 426 /*
423 m_log.DebugFormat("[NPC MODULE]: Could not find {0} to remove", 427 m_log.DebugFormat("[NPC MODULE]: Could not find {0} to remove",
@@ -457,4 +461,4 @@ namespace OpenSim.Region.OptionalModules.World.NPC
457 av.OwnerID == callerID || av.AgentId == callerID; 461 av.OwnerID == callerID || av.AgentId == callerID;
458 } 462 }
459 } 463 }
460} \ No newline at end of file 464}