From c2e75aecd1eba90d3a376896f1a798a4c9c58e6d Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Tue, 14 Apr 2009 01:57:35 +0000 Subject: * Commit a variety of fixes to bugs discovered while trying to fix the NaN singularity. * WebStatsModule doesn't crash on restart. GodsModule doesn't crash when there is no Dialog Module. LLUDPServer doesn't crash when the Operation was Aborted. * ODEPlugin does 'Almost NaN' sanity checks. * ODEPlugin sacrifices NaN avatars to the NaN black hole to appease it and keep it from sucking the rest of the world in. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 52 ++++++++++++++---------- 1 file changed, 30 insertions(+), 22 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index e5ddeb5..cda90d6 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -939,11 +939,14 @@ namespace OpenSim.Region.Framework.Scenes { if (PhysicsActor != null) { - m_scene.PhysicsScene.RemoveAvatar(PhysicsActor); - m_physicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients; - m_physicsActor.UnSubscribeEvents(); - m_physicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate; - PhysicsActor = null; + lock (m_scene.SyncRoot) + { + m_physicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients; + m_scene.PhysicsScene.RemoveAvatar(PhysicsActor); + m_physicsActor.UnSubscribeEvents(); + m_physicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate; + PhysicsActor = null; + } } } @@ -3192,25 +3195,30 @@ namespace OpenSim.Region.Framework.Scenes /// public void AddToPhysicalScene(bool isFlying) { - PhysicsScene scene = m_scene.PhysicsScene; - - PhysicsVector pVec = - new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, - AbsolutePosition.Z); - - if (m_avHeight == 127.0f) - { - m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, new PhysicsVector(0, 0, 1.56f), isFlying); - } - else + lock (m_scene.SyncRoot) { - m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, new PhysicsVector(0, 0, m_avHeight), isFlying); + PhysicsScene scene = m_scene.PhysicsScene; + + PhysicsVector pVec = + new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, + AbsolutePosition.Z); + + if (m_avHeight == 127.0f) + { + m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, new PhysicsVector(0, 0, 1.56f), + isFlying); + } + else + { + m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, + new PhysicsVector(0, 0, m_avHeight), isFlying); + } + scene.AddPhysicsActorTaint(m_physicsActor); + //m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; + m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; + m_physicsActor.SubscribeEvents(1000); + m_physicsActor.LocalID = LocalId; } - scene.AddPhysicsActorTaint(m_physicsActor); - //m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; - m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; - m_physicsActor.SubscribeEvents(1000); - m_physicsActor.LocalID = LocalId; } // Event called by the physics plugin to tell the avatar about a collision. -- cgit v1.1