Merge branch 'master' of ssh://opensimulator.org/var/git/opensim

0.7.4.1
Justin Clark-Casey (justincc) 2012-07-17 23:34:50 +01:00
commit 56870d9609
2 changed files with 24 additions and 6 deletions

View File

@ -312,11 +312,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
part.SetScriptEvents(ItemID,
(int)m_Script.GetStateEventFlags(State));
Running = false;
if (ShuttingDown)
if (!Running)
m_startOnInit = false;
Running = false;
// we get new rez events on sim restart, too
// but if there is state, then we fire the change
// event
@ -352,12 +352,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
public void Init()
{
if (!m_startOnInit)
if (ShuttingDown)
return;
if (m_startedFromSavedState)
{
Start();
if (m_startOnInit)
Start();
if (m_postOnRez)
{
PostEvent(new EventParams("on_rez",
@ -389,7 +390,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
}
else
{
Start();
if (m_startOnInit)
Start();
PostEvent(new EventParams("state_entry",
new Object[0], new DetectParams[0]));
if (m_postOnRez)

View File

@ -108,6 +108,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
private bool m_KillTimedOutScripts;
private string m_ScriptEnginesPath = null;
private ExpiringCache<UUID, bool> m_runFlags = new ExpiringCache<UUID, bool>();
/// <summary>
/// Is the entire simulator in the process of shutting down?
/// </summary>
@ -1196,6 +1198,14 @@ namespace OpenSim.Region.ScriptEngine.XEngine
if (instance != null)
instance.Init();
bool runIt;
if (m_runFlags.TryGetValue(itemID, out runIt))
{
if (!runIt)
StopScript(itemID);
m_runFlags.Remove(itemID);
}
return true;
}
@ -1568,6 +1578,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
IScriptInstance instance = GetInstance(itemID);
if (instance != null)
instance.Start();
else
m_runFlags.AddOrUpdate(itemID, true, 240);
}
public void StopScript(UUID itemID)
@ -1579,6 +1591,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
// cause issues on mono 2.6, 2.10 and possibly later where locks are not released properly on abort.
instance.Stop(1000);
}
else
{
m_runFlags.AddOrUpdate(itemID, false, 240);
}
}
public DetectParams GetDetectParams(UUID itemID, int idx)