Merge branch 'master' into careminster
Conflicts: OpenSim/Region/Framework/Scenes/Scene.cs OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs OpenSim/Region/ScriptEngine/XEngine/XEngine.csavinationmerge
commit
897dc5e77e
|
@ -227,8 +227,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
private bool m_firstHeartbeat = true;
|
private bool m_firstHeartbeat = true;
|
||||||
private int m_hbRestarts = 0;
|
private int m_hbRestarts = 0;
|
||||||
|
|
||||||
private object m_deleting_scene_object = new object();
|
|
||||||
|
|
||||||
private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time;
|
private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time;
|
||||||
private bool m_reprioritizationEnabled = true;
|
private bool m_reprioritizationEnabled = true;
|
||||||
private double m_reprioritizationInterval = 5000.0;
|
private double m_reprioritizationInterval = 5000.0;
|
||||||
|
@ -2085,15 +2083,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
public void DeleteSceneObject(SceneObjectGroup group, bool silent)
|
public void DeleteSceneObject(SceneObjectGroup group, bool silent)
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat("[SCENE]: Deleting scene object {0} {1}", group.Name, group.UUID);
|
// m_log.DebugFormat("[SCENE]: Deleting scene object {0} {1}", group.Name, group.UUID);
|
||||||
|
|
||||||
//SceneObjectPart rootPart = group.GetChildPart(group.UUID);
|
|
||||||
|
|
||||||
// Serialise calls to RemoveScriptInstances to avoid
|
group.RemoveScriptInstances(true);
|
||||||
// deadlocking on m_parts inside SceneObjectGroup
|
|
||||||
lock (m_deleting_scene_object)
|
|
||||||
{
|
|
||||||
group.RemoveScriptInstances(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
SceneObjectPart[] partList = group.Parts;
|
SceneObjectPart[] partList = group.Parts;
|
||||||
|
|
||||||
|
|
|
@ -68,8 +68,16 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool Suspended { get; set; }
|
bool Suspended { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Is the script shutting down?
|
||||||
|
/// </summary>
|
||||||
bool ShuttingDown { get; set; }
|
bool ShuttingDown { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Script state
|
||||||
|
/// </summary>
|
||||||
string State { get; set; }
|
string State { get; set; }
|
||||||
|
|
||||||
IScriptEngine Engine { get; }
|
IScriptEngine Engine { get; }
|
||||||
UUID AppDomain { get; set; }
|
UUID AppDomain { get; set; }
|
||||||
string PrimName { get; }
|
string PrimName { get; }
|
||||||
|
|
|
@ -57,44 +57,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
public class ScriptInstance : MarshalByRefObject, IScriptInstance
|
public class ScriptInstance : MarshalByRefObject, IScriptInstance
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private IScriptEngine m_Engine;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The current work item if an event for this script is running or waiting to run,
|
/// The current work item if an event for this script is running or waiting to run,
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// Null if there is no running or waiting to run event. Must be changed only under an m_EventQueue lock.
|
/// Null if there is no running or waiting to run event. Must be changed only under an EventQueue lock.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
private IScriptWorkItem m_CurrentWorkItem;
|
private IScriptWorkItem m_CurrentWorkItem;
|
||||||
|
|
||||||
private Queue m_EventQueue = new Queue(32);
|
|
||||||
private bool m_RunEvents = false;
|
|
||||||
private UUID m_ItemID;
|
|
||||||
private uint m_LocalID;
|
|
||||||
private UUID m_ObjectID;
|
|
||||||
private UUID m_AssetID;
|
|
||||||
private IScript m_Script;
|
private IScript m_Script;
|
||||||
private UUID m_AppDomain;
|
|
||||||
private DetectParams[] m_DetectParams;
|
private DetectParams[] m_DetectParams;
|
||||||
private bool m_TimerQueued;
|
private bool m_TimerQueued;
|
||||||
private DateTime m_EventStart;
|
private DateTime m_EventStart;
|
||||||
private bool m_InEvent;
|
private bool m_InEvent;
|
||||||
private string m_PrimName;
|
|
||||||
private string m_ScriptName;
|
|
||||||
private string m_Assembly;
|
private string m_Assembly;
|
||||||
private int m_StartParam;
|
|
||||||
private string m_CurrentEvent = String.Empty;
|
private string m_CurrentEvent = String.Empty;
|
||||||
private bool m_InSelfDelete;
|
private bool m_InSelfDelete;
|
||||||
private int m_MaxScriptQueue;
|
private int m_MaxScriptQueue;
|
||||||
private bool m_SaveState = true;
|
private bool m_SaveState = true;
|
||||||
private bool m_ShuttingDown;
|
|
||||||
private int m_ControlEventsInQueue;
|
private int m_ControlEventsInQueue;
|
||||||
private int m_LastControlLevel;
|
private int m_LastControlLevel;
|
||||||
private bool m_CollisionInQueue;
|
private bool m_CollisionInQueue;
|
||||||
private TaskInventoryItem m_thisScriptTask;
|
|
||||||
// The following is for setting a minimum delay between events
|
// The following is for setting a minimum delay between events
|
||||||
private double m_minEventDelay;
|
private double m_minEventDelay;
|
||||||
|
|
||||||
private long m_eventDelayTicks;
|
private long m_eventDelayTicks;
|
||||||
private long m_nextEventTimeTicks;
|
private long m_nextEventTimeTicks;
|
||||||
private bool m_startOnInit = true;
|
private bool m_startOnInit = true;
|
||||||
|
@ -105,21 +93,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
private UUID m_CurrentStateHash;
|
private UUID m_CurrentStateHash;
|
||||||
private UUID m_RegionID;
|
private UUID m_RegionID;
|
||||||
|
|
||||||
private Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>>
|
public Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> LineMap { get; set; }
|
||||||
m_LineMap;
|
|
||||||
|
|
||||||
public Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>>
|
|
||||||
LineMap
|
|
||||||
{
|
|
||||||
get { return m_LineMap; }
|
|
||||||
set { m_LineMap = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
private Dictionary<string,IScriptApi> m_Apis = new Dictionary<string,IScriptApi>();
|
private Dictionary<string,IScriptApi> m_Apis = new Dictionary<string,IScriptApi>();
|
||||||
|
|
||||||
// Script state
|
|
||||||
private string m_State = "default";
|
|
||||||
|
|
||||||
public Object[] PluginData = new Object[0];
|
public Object[] PluginData = new Object[0];
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -142,11 +119,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Running
|
public bool Running { get; set; }
|
||||||
{
|
|
||||||
get { return m_RunEvents; }
|
|
||||||
set { m_RunEvents = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Suspended
|
public bool Suspended
|
||||||
{
|
{
|
||||||
|
@ -162,11 +135,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
|
|
||||||
if (wasSuspended && !m_Suspended)
|
if (wasSuspended && !m_Suspended)
|
||||||
{
|
{
|
||||||
lock (m_EventQueue)
|
lock (EventQueue)
|
||||||
{
|
{
|
||||||
// Need to place ourselves back in a work item if there are events to process
|
// Need to place ourselves back in a work item if there are events to process
|
||||||
if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown))
|
if (EventQueue.Count > 0 && Running && !ShuttingDown)
|
||||||
m_CurrentWorkItem = m_Engine.QueueEventHandler(this);
|
m_CurrentWorkItem = Engine.QueueEventHandler(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -174,79 +147,36 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
}
|
}
|
||||||
private bool m_Suspended;
|
private bool m_Suspended;
|
||||||
|
|
||||||
public bool ShuttingDown
|
public bool ShuttingDown { get; set; }
|
||||||
{
|
|
||||||
get { return m_ShuttingDown; }
|
|
||||||
set { m_ShuttingDown = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public string State
|
public string State { get; set; }
|
||||||
{
|
|
||||||
get { return m_State; }
|
|
||||||
set { m_State = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public IScriptEngine Engine
|
public IScriptEngine Engine { get; private set; }
|
||||||
{
|
|
||||||
get { return m_Engine; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public UUID AppDomain
|
public UUID AppDomain { get; set; }
|
||||||
{
|
|
||||||
get { return m_AppDomain; }
|
|
||||||
set { m_AppDomain = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public string PrimName
|
public string PrimName { get; private set; }
|
||||||
{
|
|
||||||
get { return m_PrimName; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public string ScriptName
|
public string ScriptName { get; private set; }
|
||||||
{
|
|
||||||
get { return m_ScriptName; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public UUID ItemID
|
public UUID ItemID { get; private set; }
|
||||||
{
|
|
||||||
get { return m_ItemID; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public UUID ObjectID
|
public UUID ObjectID { get; private set; }
|
||||||
{
|
|
||||||
get { return m_ObjectID; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public uint LocalID
|
public uint LocalID { get; private set; }
|
||||||
{
|
|
||||||
get { return m_LocalID; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public UUID AssetID
|
public UUID AssetID { get; private set; }
|
||||||
{
|
|
||||||
get { return m_AssetID; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public Queue EventQueue
|
public Queue EventQueue { get; private set; }
|
||||||
{
|
|
||||||
get { return m_EventQueue; }
|
public int StartParam { get; set; }
|
||||||
}
|
|
||||||
|
public TaskInventoryItem ScriptTask { get; private set; }
|
||||||
|
|
||||||
public void ClearQueue()
|
public void ClearQueue()
|
||||||
{
|
{
|
||||||
m_TimerQueued = false;
|
m_TimerQueued = false;
|
||||||
m_EventQueue.Clear();
|
EventQueue.Clear();
|
||||||
}
|
|
||||||
|
|
||||||
public int StartParam
|
|
||||||
{
|
|
||||||
get { return m_StartParam; }
|
|
||||||
set { m_StartParam = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public TaskInventoryItem ScriptTask
|
|
||||||
{
|
|
||||||
get { return m_thisScriptTask; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ScriptInstance(IScriptEngine engine, SceneObjectPart part,
|
public ScriptInstance(IScriptEngine engine, SceneObjectPart part,
|
||||||
|
@ -255,16 +185,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
int startParam, bool postOnRez, StateSource stateSource,
|
int startParam, bool postOnRez, StateSource stateSource,
|
||||||
int maxScriptQueue)
|
int maxScriptQueue)
|
||||||
{
|
{
|
||||||
m_Engine = engine;
|
State = "default";
|
||||||
|
EventQueue = new Queue(32);
|
||||||
|
|
||||||
m_LocalID = part.LocalId;
|
Engine = engine;
|
||||||
m_ObjectID = part.UUID;
|
LocalID = part.LocalId;
|
||||||
m_ItemID = itemID;
|
ObjectID = part.UUID;
|
||||||
m_AssetID = assetID;
|
ItemID = itemID;
|
||||||
m_PrimName = primName;
|
AssetID = assetID;
|
||||||
m_ScriptName = scriptName;
|
PrimName = primName;
|
||||||
|
ScriptName = scriptName;
|
||||||
m_Assembly = assembly;
|
m_Assembly = assembly;
|
||||||
m_StartParam = startParam;
|
StartParam = startParam;
|
||||||
m_MaxScriptQueue = maxScriptQueue;
|
m_MaxScriptQueue = maxScriptQueue;
|
||||||
m_stateSource = stateSource;
|
m_stateSource = stateSource;
|
||||||
m_postOnRez = postOnRez;
|
m_postOnRez = postOnRez;
|
||||||
|
@ -274,9 +206,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
if (part != null)
|
if (part != null)
|
||||||
{
|
{
|
||||||
part.TaskInventory.LockItemsForRead(true);
|
part.TaskInventory.LockItemsForRead(true);
|
||||||
if (part.TaskInventory.ContainsKey(m_ItemID))
|
if (part.TaskInventory.ContainsKey(ItemID))
|
||||||
{
|
{
|
||||||
m_thisScriptTask = part.TaskInventory[m_ItemID];
|
ScriptTask = part.TaskInventory[ItemID];
|
||||||
}
|
}
|
||||||
part.TaskInventory.LockItemsForRead(false);
|
part.TaskInventory.LockItemsForRead(false);
|
||||||
}
|
}
|
||||||
|
@ -286,20 +218,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
foreach (string api in am.GetApis())
|
foreach (string api in am.GetApis())
|
||||||
{
|
{
|
||||||
m_Apis[api] = am.CreateApi(api);
|
m_Apis[api] = am.CreateApi(api);
|
||||||
m_Apis[api].Initialize(engine, part, m_LocalID, itemID);
|
m_Apis[api].Initialize(engine, part, LocalID, itemID);
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (dom != System.AppDomain.CurrentDomain)
|
if (dom != System.AppDomain.CurrentDomain)
|
||||||
m_Script = (IScript)dom.CreateInstanceAndUnwrap(
|
m_Script = (IScript)dom.CreateInstanceAndUnwrap(
|
||||||
Path.GetFileNameWithoutExtension(assembly),
|
Path.GetFileNameWithoutExtension(assembly),
|
||||||
"SecondLife.Script");
|
"SecondLife.Script");
|
||||||
else
|
else
|
||||||
m_Script = (IScript)Assembly.Load(
|
m_Script = (IScript)Assembly.Load(
|
||||||
Path.GetFileNameWithoutExtension(assembly)).CreateInstance(
|
Path.GetFileNameWithoutExtension(assembly)).CreateInstance(
|
||||||
"SecondLife.Script");
|
"SecondLife.Script");
|
||||||
|
|
||||||
|
|
||||||
//ILease lease = (ILease)RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass);
|
//ILease lease = (ILease)RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass);
|
||||||
//RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass);
|
//RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass);
|
||||||
|
@ -321,7 +252,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
|
|
||||||
// // m_log.Debug("[Script] Script instance created");
|
// // m_log.Debug("[Script] Script instance created");
|
||||||
|
|
||||||
part.SetScriptEvents(m_ItemID,
|
part.SetScriptEvents(ItemID,
|
||||||
(int)m_Script.GetStateEventFlags(State));
|
(int)m_Script.GetStateEventFlags(State));
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -336,7 +267,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
m_SaveState = true;
|
m_SaveState = true;
|
||||||
|
|
||||||
string savedState = Path.Combine(Path.GetDirectoryName(assembly),
|
string savedState = Path.Combine(Path.GetDirectoryName(assembly),
|
||||||
m_ItemID.ToString() + ".state");
|
ItemID.ToString() + ".state");
|
||||||
if (File.Exists(savedState))
|
if (File.Exists(savedState))
|
||||||
{
|
{
|
||||||
string xml = String.Empty;
|
string xml = String.Empty;
|
||||||
|
@ -360,24 +291,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
|
|
||||||
ScriptSerializer.Deserialize(xml, this);
|
ScriptSerializer.Deserialize(xml, this);
|
||||||
|
|
||||||
AsyncCommandManager.CreateFromData(m_Engine,
|
AsyncCommandManager.CreateFromData(Engine,
|
||||||
m_LocalID, m_ItemID, m_ObjectID,
|
LocalID, ItemID, ObjectID,
|
||||||
PluginData);
|
PluginData);
|
||||||
|
|
||||||
// m_log.DebugFormat("[Script] Successfully retrieved state for script {0}.{1}", m_PrimName, m_ScriptName);
|
// m_log.DebugFormat("[Script] Successfully retrieved state for script {0}.{1}", PrimName, m_ScriptName);
|
||||||
|
|
||||||
part.SetScriptEvents(m_ItemID,
|
part.SetScriptEvents(ItemID,
|
||||||
(int)m_Script.GetStateEventFlags(State));
|
(int)m_Script.GetStateEventFlags(State));
|
||||||
|
|
||||||
if (m_RunEvents && (!m_ShuttingDown))
|
Running = false;
|
||||||
{
|
|
||||||
m_RunEvents = false;
|
if (ShuttingDown)
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_RunEvents = false;
|
|
||||||
m_startOnInit = false;
|
m_startOnInit = 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
|
||||||
|
@ -386,7 +312,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
// We loaded state, don't force a re-save
|
// We loaded state, don't force a re-save
|
||||||
m_SaveState = false;
|
m_SaveState = false;
|
||||||
m_startedFromSavedState = true;
|
m_startedFromSavedState = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -405,7 +330,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
}
|
}
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
// ScenePresence presence = m_Engine.World.GetScenePresence(part.OwnerID);
|
// ScenePresence presence = Engine.World.GetScenePresence(part.OwnerID);
|
||||||
|
|
||||||
// if (presence != null && (!postOnRez))
|
// if (presence != null && (!postOnRez))
|
||||||
// presence.ControllingClient.SendAgentAlertMessage("Compile successful", false);
|
// presence.ControllingClient.SendAgentAlertMessage("Compile successful", false);
|
||||||
|
@ -423,7 +348,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
if (m_postOnRez)
|
if (m_postOnRez)
|
||||||
{
|
{
|
||||||
PostEvent(new EventParams("on_rez",
|
PostEvent(new EventParams("on_rez",
|
||||||
new Object[] {new LSL_Types.LSLInteger(m_StartParam)}, new DetectParams[0]));
|
new Object[] {new LSL_Types.LSLInteger(StartParam)}, new DetectParams[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_stateSource == StateSource.AttachedRez)
|
if (m_stateSource == StateSource.AttachedRez)
|
||||||
|
@ -457,7 +382,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
if (m_postOnRez)
|
if (m_postOnRez)
|
||||||
{
|
{
|
||||||
PostEvent(new EventParams("on_rez",
|
PostEvent(new EventParams("on_rez",
|
||||||
new Object[] {new LSL_Types.LSLInteger(m_StartParam)}, new DetectParams[0]));
|
new Object[] {new LSL_Types.LSLInteger(StartParam)}, new DetectParams[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_stateSource == StateSource.AttachedRez)
|
if (m_stateSource == StateSource.AttachedRez)
|
||||||
|
@ -471,27 +396,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
|
|
||||||
private void ReleaseControls()
|
private void ReleaseControls()
|
||||||
{
|
{
|
||||||
SceneObjectPart part = m_Engine.World.GetSceneObjectPart(m_LocalID);
|
SceneObjectPart part = Engine.World.GetSceneObjectPart(LocalID);
|
||||||
|
|
||||||
if (part != null)
|
if (part != null)
|
||||||
{
|
{
|
||||||
int permsMask;
|
int permsMask;
|
||||||
UUID permsGranter;
|
UUID permsGranter;
|
||||||
part.TaskInventory.LockItemsForRead(true);
|
part.TaskInventory.LockItemsForRead(true);
|
||||||
if (!part.TaskInventory.ContainsKey(m_ItemID))
|
if (!part.TaskInventory.ContainsKey(ItemID))
|
||||||
{
|
{
|
||||||
part.TaskInventory.LockItemsForRead(false);
|
part.TaskInventory.LockItemsForRead(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
permsGranter = part.TaskInventory[m_ItemID].PermsGranter;
|
permsGranter = part.TaskInventory[ItemID].PermsGranter;
|
||||||
permsMask = part.TaskInventory[m_ItemID].PermsMask;
|
permsMask = part.TaskInventory[ItemID].PermsMask;
|
||||||
part.TaskInventory.LockItemsForRead(false);
|
part.TaskInventory.LockItemsForRead(false);
|
||||||
|
|
||||||
if ((permsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0)
|
if ((permsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0)
|
||||||
{
|
{
|
||||||
ScenePresence presence = m_Engine.World.GetScenePresence(permsGranter);
|
ScenePresence presence = Engine.World.GetScenePresence(permsGranter);
|
||||||
if (presence != null)
|
if (presence != null)
|
||||||
presence.UnRegisterControlEventsToScript(m_LocalID, m_ItemID);
|
presence.UnRegisterControlEventsToScript(LocalID, ItemID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -499,13 +424,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
public void DestroyScriptInstance()
|
public void DestroyScriptInstance()
|
||||||
{
|
{
|
||||||
ReleaseControls();
|
ReleaseControls();
|
||||||
AsyncCommandManager.RemoveScript(m_Engine, m_LocalID, m_ItemID);
|
AsyncCommandManager.RemoveScript(Engine, LocalID, ItemID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveState()
|
public void RemoveState()
|
||||||
{
|
{
|
||||||
string savedState = Path.Combine(Path.GetDirectoryName(m_Assembly),
|
string savedState = Path.Combine(Path.GetDirectoryName(m_Assembly),
|
||||||
m_ItemID.ToString() + ".state");
|
ItemID.ToString() + ".state");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -518,7 +443,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
|
|
||||||
public void VarDump(Dictionary<string, object> vars)
|
public void VarDump(Dictionary<string, object> vars)
|
||||||
{
|
{
|
||||||
// m_log.Info("Variable dump for script "+ m_ItemID.ToString());
|
// m_log.Info("Variable dump for script "+ ItemID.ToString());
|
||||||
// foreach (KeyValuePair<string, object> v in vars)
|
// foreach (KeyValuePair<string, object> v in vars)
|
||||||
// {
|
// {
|
||||||
// m_log.Info("Variable: "+v.Key+" = "+v.Value.ToString());
|
// m_log.Info("Variable: "+v.Key+" = "+v.Value.ToString());
|
||||||
|
@ -527,17 +452,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
|
|
||||||
public void Start()
|
public void Start()
|
||||||
{
|
{
|
||||||
lock (m_EventQueue)
|
lock (EventQueue)
|
||||||
{
|
{
|
||||||
if (Running)
|
if (Running)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_RunEvents = true;
|
Running = true;
|
||||||
|
|
||||||
if (m_EventQueue.Count > 0)
|
if (EventQueue.Count > 0)
|
||||||
{
|
{
|
||||||
if (m_CurrentWorkItem == null)
|
if (m_CurrentWorkItem == null)
|
||||||
m_CurrentWorkItem = m_Engine.QueueEventHandler(this);
|
m_CurrentWorkItem = Engine.QueueEventHandler(this);
|
||||||
// else
|
// else
|
||||||
// m_log.Error("[Script] Tried to start a script that was already queued");
|
// m_log.Error("[Script] Tried to start a script that was already queued");
|
||||||
}
|
}
|
||||||
|
@ -547,11 +472,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
public bool Stop(int timeout)
|
public bool Stop(int timeout)
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
// "[SCRIPT INSTANCE]: Stopping script {0} {1} with timeout {2}", ScriptName, ItemID, timeout);
|
// "[SCRIPT INSTANCE]: Stopping script {0} {1} in {2} {3} with timeout {4} {5} {6}",
|
||||||
|
// ScriptName, ItemID, PrimName, ObjectID, timeout, m_InSelfDelete, DateTime.Now.Ticks);
|
||||||
|
|
||||||
IScriptWorkItem workItem;
|
IScriptWorkItem workItem;
|
||||||
|
|
||||||
lock (m_EventQueue)
|
lock (EventQueue)
|
||||||
{
|
{
|
||||||
if (!Running)
|
if (!Running)
|
||||||
return true;
|
return true;
|
||||||
|
@ -559,7 +485,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
// If we're not running or waiting to run an event then we can safely stop.
|
// If we're not running or waiting to run an event then we can safely stop.
|
||||||
if (m_CurrentWorkItem == null)
|
if (m_CurrentWorkItem == null)
|
||||||
{
|
{
|
||||||
m_RunEvents = false;
|
Running = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -567,21 +493,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
if (m_CurrentWorkItem.Cancel())
|
if (m_CurrentWorkItem.Cancel())
|
||||||
{
|
{
|
||||||
m_CurrentWorkItem = null;
|
m_CurrentWorkItem = null;
|
||||||
m_RunEvents = false;
|
Running = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
workItem = m_CurrentWorkItem;
|
workItem = m_CurrentWorkItem;
|
||||||
m_RunEvents = false;
|
Running = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait for the current event to complete.
|
// Wait for the current event to complete.
|
||||||
if (workItem.Wait(new TimeSpan((long)timeout * 100000)))
|
if (!m_InSelfDelete && workItem.Wait(new TimeSpan((long)timeout * 100000)))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
lock (m_EventQueue)
|
lock (EventQueue)
|
||||||
{
|
{
|
||||||
workItem = m_CurrentWorkItem;
|
workItem = m_CurrentWorkItem;
|
||||||
}
|
}
|
||||||
|
@ -593,12 +519,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
// forcibly abort the work item (this aborts the underlying thread).
|
// forcibly abort the work item (this aborts the underlying thread).
|
||||||
if (!m_InSelfDelete)
|
if (!m_InSelfDelete)
|
||||||
{
|
{
|
||||||
// m_log.ErrorFormat("[SCRIPT INSTANCE]: Aborting script {0} {1}", ScriptName, ItemID);
|
// m_log.ErrorFormat(
|
||||||
|
// "[SCRIPT INSTANCE]: Aborting script {0} {1} in prim {2} {3} {4} {5}",
|
||||||
|
// ScriptName, ItemID, PrimName, ObjectID, m_InSelfDelete, DateTime.Now.Ticks);
|
||||||
|
|
||||||
workItem.Abort();
|
workItem.Abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
lock (m_EventQueue)
|
lock (EventQueue)
|
||||||
{
|
{
|
||||||
m_CurrentWorkItem = null;
|
m_CurrentWorkItem = null;
|
||||||
}
|
}
|
||||||
|
@ -632,7 +560,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
public void PostEvent(EventParams data)
|
public void PostEvent(EventParams data)
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat("[Script] Posted event {2} in state {3} to {0}.{1}",
|
// m_log.DebugFormat("[Script] Posted event {2} in state {3} to {0}.{1}",
|
||||||
// m_PrimName, m_ScriptName, data.EventName, m_State);
|
// PrimName, ScriptName, data.EventName, State);
|
||||||
|
|
||||||
if (!Running)
|
if (!Running)
|
||||||
return;
|
return;
|
||||||
|
@ -647,9 +575,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
m_nextEventTimeTicks = DateTime.Now.Ticks + m_eventDelayTicks;
|
m_nextEventTimeTicks = DateTime.Now.Ticks + m_eventDelayTicks;
|
||||||
}
|
}
|
||||||
|
|
||||||
lock (m_EventQueue)
|
lock (EventQueue)
|
||||||
{
|
{
|
||||||
if (m_EventQueue.Count >= m_MaxScriptQueue)
|
if (EventQueue.Count >= m_MaxScriptQueue)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (data.EventName == "timer")
|
if (data.EventName == "timer")
|
||||||
|
@ -693,11 +621,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
m_CollisionInQueue = true;
|
m_CollisionInQueue = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_EventQueue.Enqueue(data);
|
EventQueue.Enqueue(data);
|
||||||
|
|
||||||
if (m_CurrentWorkItem == null)
|
if (m_CurrentWorkItem == null)
|
||||||
{
|
{
|
||||||
m_CurrentWorkItem = m_Engine.QueueEventHandler(this);
|
m_CurrentWorkItem = Engine.QueueEventHandler(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -709,28 +637,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
public object EventProcessor()
|
public object EventProcessor()
|
||||||
{
|
{
|
||||||
EventParams data = null;
|
EventParams data = null;
|
||||||
|
// We check here as the thread stopping this instance from running may itself hold the m_Script lock.
|
||||||
|
if (!Running)
|
||||||
|
return 0;
|
||||||
|
|
||||||
// m_log.DebugFormat("[XEngine]: EventProcessor() invoked for {0}.{1}", PrimName, ScriptName);
|
// m_log.DebugFormat("[XEngine]: EventProcessor() invoked for {0}.{1}", PrimName, ScriptName);
|
||||||
|
|
||||||
if (Suspended)
|
if (Suspended)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
lock (m_EventQueue)
|
lock (EventQueue)
|
||||||
{
|
{
|
||||||
data = (EventParams) m_EventQueue.Dequeue();
|
data = (EventParams) EventQueue.Dequeue();
|
||||||
if (data == null) // Shouldn't happen
|
if (data == null) // Shouldn't happen
|
||||||
{
|
{
|
||||||
if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown))
|
if (EventQueue.Count > 0 && Running && !ShuttingDown)
|
||||||
{
|
{
|
||||||
if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown))
|
m_CurrentWorkItem = Engine.QueueEventHandler(this);
|
||||||
{
|
|
||||||
m_CurrentWorkItem = m_Engine.QueueEventHandler(this);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_CurrentWorkItem = null;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -760,28 +683,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
if (data.EventName == "state") // Hardcoded state change
|
if (data.EventName == "state") // Hardcoded state change
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat("[Script] Script {0}.{1} state set to {2}",
|
// m_log.DebugFormat("[Script] Script {0}.{1} state set to {2}",
|
||||||
// m_PrimName, m_ScriptName, data.Params[0].ToString());
|
// PrimName, ScriptName, data.Params[0].ToString());
|
||||||
m_State = data.Params[0].ToString();
|
State = data.Params[0].ToString();
|
||||||
AsyncCommandManager.RemoveScript(m_Engine,
|
AsyncCommandManager.RemoveScript(Engine,
|
||||||
m_LocalID, m_ItemID);
|
LocalID, ItemID);
|
||||||
|
|
||||||
SceneObjectPart part = m_Engine.World.GetSceneObjectPart(
|
SceneObjectPart part = Engine.World.GetSceneObjectPart(
|
||||||
m_LocalID);
|
LocalID);
|
||||||
if (part != null)
|
if (part != null)
|
||||||
{
|
{
|
||||||
part.SetScriptEvents(m_ItemID,
|
part.SetScriptEvents(ItemID,
|
||||||
(int)m_Script.GetStateEventFlags(State));
|
(int)m_Script.GetStateEventFlags(State));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (m_Engine.World.PipeEventsForScript(m_LocalID) ||
|
if (Engine.World.PipeEventsForScript(LocalID) ||
|
||||||
data.EventName == "control") // Don't freeze avies!
|
data.EventName == "control") // Don't freeze avies!
|
||||||
{
|
{
|
||||||
SceneObjectPart part = m_Engine.World.GetSceneObjectPart(
|
SceneObjectPart part = Engine.World.GetSceneObjectPart(
|
||||||
m_LocalID);
|
LocalID);
|
||||||
// m_log.DebugFormat("[Script] Delivered event {2} in state {3} to {0}.{1}",
|
// m_log.DebugFormat("[Script] Delivered event {2} in state {3} to {0}.{1}",
|
||||||
// m_PrimName, m_ScriptName, data.EventName, m_State);
|
// PrimName, ScriptName, data.EventName, State);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -823,7 +746,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
|
|
||||||
if (text.Length > 1000)
|
if (text.Length > 1000)
|
||||||
text = text.Substring(0, 1000);
|
text = text.Substring(0, 1000);
|
||||||
m_Engine.World.SimChat(Utils.StringToBytes(text),
|
Engine.World.SimChat(Utils.StringToBytes(text),
|
||||||
ChatTypeEnum.DebugChannel, 2147483647,
|
ChatTypeEnum.DebugChannel, 2147483647,
|
||||||
part.AbsolutePosition,
|
part.AbsolutePosition,
|
||||||
part.Name, part.UUID, false);
|
part.Name, part.UUID, false);
|
||||||
|
@ -845,26 +768,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
{
|
{
|
||||||
m_InSelfDelete = true;
|
m_InSelfDelete = true;
|
||||||
if (part != null)
|
if (part != null)
|
||||||
m_Engine.World.DeleteSceneObject(part.ParentGroup, false);
|
Engine.World.DeleteSceneObject(part.ParentGroup, false);
|
||||||
}
|
}
|
||||||
else if ((e is TargetInvocationException) && (e.InnerException is ScriptDeleteException))
|
else if ((e is TargetInvocationException) && (e.InnerException is ScriptDeleteException))
|
||||||
{
|
{
|
||||||
m_InSelfDelete = true;
|
m_InSelfDelete = true;
|
||||||
if (part != null)
|
if (part != null)
|
||||||
part.Inventory.RemoveInventoryItem(m_ItemID);
|
part.Inventory.RemoveInventoryItem(ItemID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// If there are more events and we are currently running and not shutting down, then ask the
|
// If there are more events and we are currently running and not shutting down, then ask the
|
||||||
// script engine to run the next event.
|
// script engine to run the next event.
|
||||||
lock (m_EventQueue)
|
lock (EventQueue)
|
||||||
{
|
{
|
||||||
if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown))
|
if (EventQueue.Count > 0 && Running && !ShuttingDown)
|
||||||
{
|
{
|
||||||
m_CurrentWorkItem = m_Engine.QueueEventHandler(this);
|
m_CurrentWorkItem = Engine.QueueEventHandler(this);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -897,15 +819,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
ReleaseControls();
|
ReleaseControls();
|
||||||
|
|
||||||
Stop(0);
|
Stop(0);
|
||||||
SceneObjectPart part=m_Engine.World.GetSceneObjectPart(m_LocalID);
|
SceneObjectPart part = Engine.World.GetSceneObjectPart(LocalID);
|
||||||
part.Inventory.GetInventoryItem(m_ItemID).PermsMask = 0;
|
part.Inventory.GetInventoryItem(ItemID).PermsMask = 0;
|
||||||
part.Inventory.GetInventoryItem(m_ItemID).PermsGranter = UUID.Zero;
|
part.Inventory.GetInventoryItem(ItemID).PermsGranter = UUID.Zero;
|
||||||
AsyncCommandManager.RemoveScript(m_Engine, m_LocalID, m_ItemID);
|
AsyncCommandManager.RemoveScript(Engine, LocalID, ItemID);
|
||||||
m_EventQueue.Clear();
|
EventQueue.Clear();
|
||||||
m_Script.ResetVars();
|
m_Script.ResetVars();
|
||||||
m_State = "default";
|
State = "default";
|
||||||
|
|
||||||
part.SetScriptEvents(m_ItemID,
|
part.SetScriptEvents(ItemID,
|
||||||
(int)m_Script.GetStateEventFlags(State));
|
(int)m_Script.GetStateEventFlags(State));
|
||||||
if (running)
|
if (running)
|
||||||
Start();
|
Start();
|
||||||
|
@ -923,16 +845,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
ReleaseControls();
|
ReleaseControls();
|
||||||
|
|
||||||
m_Script.ResetVars();
|
m_Script.ResetVars();
|
||||||
SceneObjectPart part=m_Engine.World.GetSceneObjectPart(m_LocalID);
|
SceneObjectPart part = Engine.World.GetSceneObjectPart(LocalID);
|
||||||
part.Inventory.GetInventoryItem(m_ItemID).PermsMask = 0;
|
part.Inventory.GetInventoryItem(ItemID).PermsMask = 0;
|
||||||
part.Inventory.GetInventoryItem(m_ItemID).PermsGranter = UUID.Zero;
|
part.Inventory.GetInventoryItem(ItemID).PermsGranter = UUID.Zero;
|
||||||
AsyncCommandManager.RemoveScript(m_Engine, m_LocalID, m_ItemID);
|
AsyncCommandManager.RemoveScript(Engine, LocalID, ItemID);
|
||||||
|
|
||||||
m_EventQueue.Clear();
|
EventQueue.Clear();
|
||||||
m_Script.ResetVars();
|
m_Script.ResetVars();
|
||||||
m_State = "default";
|
State = "default";
|
||||||
|
|
||||||
part.SetScriptEvents(m_ItemID,
|
part.SetScriptEvents(ItemID,
|
||||||
(int)m_Script.GetStateEventFlags(State));
|
(int)m_Script.GetStateEventFlags(State));
|
||||||
|
|
||||||
if (m_CurrentEvent != "state_entry")
|
if (m_CurrentEvent != "state_entry")
|
||||||
|
@ -984,7 +906,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginData = AsyncCommandManager.GetSerializationData(m_Engine, m_ItemID);
|
PluginData = AsyncCommandManager.GetSerializationData(Engine, ItemID);
|
||||||
|
|
||||||
string xml = ScriptSerializer.Serialize(this);
|
string xml = ScriptSerializer.Serialize(this);
|
||||||
|
|
||||||
|
@ -996,7 +918,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
FileStream fs = File.Create(Path.Combine(Path.GetDirectoryName(assembly), m_ItemID.ToString() + ".state"));
|
FileStream fs = File.Create(Path.Combine(Path.GetDirectoryName(assembly), ItemID.ToString() + ".state"));
|
||||||
System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding();
|
System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding();
|
||||||
Byte[] buf = enc.GetBytes(xml);
|
Byte[] buf = enc.GetBytes(xml);
|
||||||
fs.Write(buf, 0, buf.Length);
|
fs.Write(buf, 0, buf.Length);
|
||||||
|
@ -1006,7 +928,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
{
|
{
|
||||||
// m_log.Error("Unable to save xml\n"+e.ToString());
|
// m_log.Error("Unable to save xml\n"+e.ToString());
|
||||||
}
|
}
|
||||||
//if (!File.Exists(Path.Combine(Path.GetDirectoryName(assembly), m_ItemID.ToString() + ".state")))
|
//if (!File.Exists(Path.Combine(Path.GetDirectoryName(assembly), ItemID.ToString() + ".state")))
|
||||||
//{
|
//{
|
||||||
// throw new Exception("Completed persistence save, but no file was created");
|
// throw new Exception("Completed persistence save, but no file was created");
|
||||||
//}
|
//}
|
||||||
|
@ -1023,7 +945,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return String.Format("{0} {1} on {2}", m_ScriptName, m_ItemID, m_PrimName);
|
return String.Format("{0} {1} on {2}", ScriptName, ItemID, PrimName);
|
||||||
}
|
}
|
||||||
|
|
||||||
string FormatException(Exception e)
|
string FormatException(Exception e)
|
||||||
|
@ -1091,7 +1013,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
|
|
||||||
// Force an update of the in-memory plugin data
|
// Force an update of the in-memory plugin data
|
||||||
//
|
//
|
||||||
PluginData = AsyncCommandManager.GetSerializationData(m_Engine, m_ItemID);
|
PluginData = AsyncCommandManager.GetSerializationData(Engine, ItemID);
|
||||||
|
|
||||||
return ScriptSerializer.Serialize(this);
|
return ScriptSerializer.Serialize(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -244,12 +244,16 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
get { return m_ConfigSource; }
|
get { return m_ConfigSource; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Event fired after the script engine has finished removing a script.
|
||||||
|
/// </summary>
|
||||||
public event ScriptRemoved OnScriptRemoved;
|
public event ScriptRemoved OnScriptRemoved;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Event fired after the script engine has finished removing a script from an object.
|
||||||
|
/// </summary>
|
||||||
public event ObjectRemoved OnObjectRemoved;
|
public event ObjectRemoved OnObjectRemoved;
|
||||||
|
|
||||||
//
|
|
||||||
// IRegionModule functions
|
|
||||||
//
|
|
||||||
public void Initialise(IConfigSource configSource)
|
public void Initialise(IConfigSource configSource)
|
||||||
{
|
{
|
||||||
if (configSource.Configs["XEngine"] == null)
|
if (configSource.Configs["XEngine"] == null)
|
||||||
|
@ -1199,7 +1203,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
m_Scripts.Remove(itemID);
|
m_Scripts.Remove(itemID);
|
||||||
lockScriptsForWrite(false);
|
lockScriptsForWrite(false);
|
||||||
instance.ClearQueue();
|
instance.ClearQueue();
|
||||||
instance.Stop(0);
|
|
||||||
|
// Give the script some time to finish processing its last event. Simply aborting the script thread can
|
||||||
|
// cause issues on mono 2.6, 2.10 and possibly later where locks are not released properly on abort.
|
||||||
|
instance.Stop(1000);
|
||||||
|
|
||||||
// bool objectRemoved = false;
|
// bool objectRemoved = false;
|
||||||
|
|
||||||
|
@ -1231,8 +1238,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
UnloadAppDomain(instance.AppDomain);
|
UnloadAppDomain(instance.AppDomain);
|
||||||
}
|
}
|
||||||
|
|
||||||
instance = null;
|
|
||||||
|
|
||||||
ObjectRemoved handlerObjectRemoved = OnObjectRemoved;
|
ObjectRemoved handlerObjectRemoved = OnObjectRemoved;
|
||||||
if (handlerObjectRemoved != null)
|
if (handlerObjectRemoved != null)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue