From 2f81e53f63012f0ed1623dc6159da01a3807fbf6 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 15 Mar 2012 00:20:47 +0000 Subject: Fix a problem where multiple near simultaneous calls to llDie() from multiple scripts in the same linkset can cause unnecessary thread aborts. The first llDie() could lock Scene.m_deleting_scene_object. The second llDie() would then wait at this lock. The first llDie() would go on to remove the second script but always abort it since the second script's WorkItem would not go away. Easiest solution here is to remove the m_deleting_scene_object since it's no longer justified - we no longer lock m_parts but take a copy instead. This also requires an adjustment in XEngine.OnRemoveScript not to use instance.ObjectID instead when firing the OnObjectRemoved event. --- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/XEngine') diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 44397b7..105d97d 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -176,12 +176,16 @@ namespace OpenSim.Region.ScriptEngine.XEngine get { return m_ConfigSource; } } + /// + /// Event fired after the script engine has finished removing a script. + /// public event ScriptRemoved OnScriptRemoved; + + /// + /// Event fired after the script engine has finished removing a script from an object. + /// public event ObjectRemoved OnObjectRemoved; - // - // IRegionModule functions - // public void Initialise(IConfigSource configSource) { if (configSource.Configs["XEngine"] == null) @@ -1122,7 +1126,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine // 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; lock (m_PrimObjects) @@ -1153,14 +1157,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine UnloadAppDomain(instance.AppDomain); } - instance = null; - ObjectRemoved handlerObjectRemoved = OnObjectRemoved; if (handlerObjectRemoved != null) - { - SceneObjectPart part = m_Scene.GetSceneObjectPart(localID); - handlerObjectRemoved(part.UUID); - } + handlerObjectRemoved(instance.ObjectID); ScriptRemoved handlerScriptRemoved = OnScriptRemoved; if (handlerScriptRemoved != null) -- cgit v1.1