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

0.7.4.1
Justin Clark-Casey (justincc) 2012-07-17 23:48:53 +01:00
commit b9749d5aaf
2 changed files with 24 additions and 6 deletions

View File

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

View File

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