From cf37b3b9434ca940fa635c0e951fa9ac7c07175a Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 22 Dec 2010 03:25:30 +0100 Subject: [PATCH] Prevent a null ref when an avatar login doesn't go as planned --- OpenSim/Framework/Watchdog.cs | 2 +- OpenSim/Region/Framework/Scenes/Scene.cs | 3 ++- OpenSim/Region/Framework/Scenes/SceneViewer.cs | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/OpenSim/Framework/Watchdog.cs b/OpenSim/Framework/Watchdog.cs index 9baf3a0702..3389ecb014 100644 --- a/OpenSim/Framework/Watchdog.cs +++ b/OpenSim/Framework/Watchdog.cs @@ -127,7 +127,7 @@ namespace OpenSim.Framework m_threads.Add(threadInfo.Thread.ManagedThreadId, threadInfo); } - private static bool RemoveThread(int threadID) + public static bool RemoveThread(int threadID) { lock (m_threads) return m_threads.Remove(threadID); diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index d915807aa7..deeb81724f 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1093,6 +1093,7 @@ namespace OpenSim.Region.Framework.Scenes { m_log.ErrorFormat("[SCENE]: Restarting heartbeat thread because it hasn't reported in in region {0}", RegionInfo.RegionName); HeartbeatThread.Abort(); + Watchdog.RemoveThread(HeartbeatThread.ManagedThreadId); HeartbeatThread = null; } m_lastUpdate = Util.EnvironmentTickCount(); @@ -4801,7 +4802,7 @@ namespace OpenSim.Region.Framework.Scenes if (m_firstHeartbeat) return; - if (Util.EnvironmentTickCountSubtract(m_lastUpdate) > 2000) + if (Util.EnvironmentTickCountSubtract(m_lastUpdate) > 10000) StartTimer(); } diff --git a/OpenSim/Region/Framework/Scenes/SceneViewer.cs b/OpenSim/Region/Framework/Scenes/SceneViewer.cs index b44a0100a4..40a73a9d4c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneViewer.cs +++ b/OpenSim/Region/Framework/Scenes/SceneViewer.cs @@ -106,7 +106,7 @@ namespace OpenSim.Region.Framework.Scenes g.ScheduleFullUpdateToAvatar(m_presence); } - while (m_partsUpdateQueue.Count > 0) + while (m_partsUpdateQueue.Count != null && m_partsUpdateQueue.Count > 0) { SceneObjectPart part = m_partsUpdateQueue.Dequeue();