From 5e6483f209966aaf1ad503627c73608cd7e59648 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Wed, 12 Dec 2007 18:03:37 +0000 Subject: * In our quest for sim heartbeat stats, we're a touch closer to accurate object count on sim stats. * Fixed a rare, but possible NullReferenceException --- OpenSim/Region/Environment/Scenes/InnerScene.cs | 2 +- .../Region/Environment/Scenes/Scene.Inventory.cs | 1 + OpenSim/Region/Environment/Scenes/Scene.cs | 22 +++++++++++++--------- 3 files changed, 15 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes') diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index 3fe9a7b..a7515f7 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs @@ -870,7 +870,7 @@ namespace OpenSim.Region.Environment.Scenes SceneObjectGroup copy = originPrim.Copy(AgentID, GroupID); copy.AbsolutePosition = copy.AbsolutePosition + offset; Entities.Add(copy.UUID, copy); - + m_numPrim++; copy.ScheduleGroupForFullUpdate(); } } diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index e373eda..f13178c 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -518,6 +518,7 @@ namespace OpenSim.Region.Environment.Scenes lock (Entities) { Entities.Remove(group.UUID); + m_innerScene.RemoveAPrimCount(); } group.DeleteParts(); } diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index ef6d1a1..934e425 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -966,7 +966,6 @@ namespace OpenSim.Region.Environment.Scenes // subscribe to physics events. rootPart.DoPhysicsPropertyUpdate(UsePhysics, true); } - m_innerScene.AddAPrimCount(); } } @@ -1162,19 +1161,24 @@ namespace OpenSim.Region.Environment.Scenes /// public override void RemoveClient(LLUUID agentID) { - m_eventManager.TriggerOnRemovePresence(agentID); - ScenePresence avatar = GetScenePresence(agentID); - - if (avatar.IsChildAgent) + try { - m_innerScene.removeUserCount(false); + if (avatar.IsChildAgent) + { + m_innerScene.removeUserCount(false); + } + else + { + m_innerScene.removeUserCount(true); + } } - else + catch (System.NullReferenceException) { - m_innerScene.removeUserCount(true); + // We don't know which count to remove it from + // Avatar is already disposed :/ } - + m_eventManager.TriggerOnRemovePresence(agentID); Broadcast(delegate(IClientAPI client) { try -- cgit v1.1