Don't start KeyframeMotion timers until all the regions are ready. This prevents problems in megaregions (prims that think they've crossed over to other regions).

0.8.0.3
Oren Hurvitz 2013-11-25 19:22:09 +02:00 committed by Justin Clark-Casey (justincc)
parent 120f872d2b
commit 0237d9113d
1 changed files with 28 additions and 2 deletions

View File

@ -47,7 +47,7 @@ namespace OpenSim.Region.Framework.Scenes
{
public class KeyframeTimer
{
private static Dictionary<Scene, KeyframeTimer>m_timers =
private static Dictionary<Scene, KeyframeTimer> m_timers =
new Dictionary<Scene, KeyframeTimer>();
private Timer m_timer;
@ -67,8 +67,15 @@ namespace OpenSim.Region.Framework.Scenes
m_timer.Interval = TickDuration;
m_timer.AutoReset = true;
m_timer.Elapsed += OnTimer;
}
m_timer.Start();
public void Start()
{
lock (m_timer)
{
if (!m_timer.Enabled)
m_timer.Start();
}
}
private void OnTimer(object sender, ElapsedEventArgs ea)
@ -120,6 +127,25 @@ namespace OpenSim.Region.Framework.Scenes
{
timer = new KeyframeTimer(motion.Scene);
m_timers[motion.Scene] = timer;
if (!SceneManager.Instance.AllRegionsReady)
{
// Start the timers only once all the regions are ready. This is required
// when using megaregions, because the megaregion is correctly configured
// only after all the regions have been loaded. (If we don't do this then
// when the prim moves it might think that it crossed into a region.)
SceneManager.Instance.OnRegionsReadyStatusChange += delegate(SceneManager sm)
{
if (sm.AllRegionsReady)
timer.Start();
};
}
// Check again, in case the regions were started while we were adding the event handler
if (SceneManager.Instance.AllRegionsReady)
{
timer.Start();
}
}
}