From 866c85be0d1c28b404e065b69eca64a8a86726a7 Mon Sep 17 00:00:00 2001
From: diva
Date: Wed, 14 Jan 2009 04:18:28 +0000
Subject: Easy on locking m_scenePresences in RequestTeleportLocation. With the
 extra locks of SceneGraph ScenePresences introduced in 7982, this was making
 TPs not close the agent in the departing region due to locking. That locking
 problem seemed to occur only in Linux/mono -- I suspect a mono bug here.

---
 OpenSim/Region/Environment/Scenes/Scene.cs | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

(limited to 'OpenSim')

diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index a837fba..bbc6232 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -3139,13 +3139,16 @@ namespace OpenSim.Region.Environment.Scenes
         public void RequestTeleportLocation(IClientAPI remoteClient, ulong regionHandle, Vector3 position,
                                             Vector3 lookAt, uint teleportFlags)
         {
+            ScenePresence sp = null;
             lock (m_scenePresences)
             {
                 if (m_scenePresences.ContainsKey(remoteClient.AgentId))
-                {
-                    m_sceneGridService.RequestTeleportToLocation(m_scenePresences[remoteClient.AgentId], regionHandle,
-                                                                 position, lookAt, teleportFlags);
-                }
+                    sp = m_scenePresences[remoteClient.AgentId];
+            }
+            if (sp!= null)
+            {
+                m_sceneGridService.RequestTeleportToLocation(sp, regionHandle,
+                                                             position, lookAt, teleportFlags);
             }
         }
 
-- 
cgit v1.1