diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/XEngine/XEngine.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index ab41873..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 | |||
176 | get { return m_ConfigSource; } | 176 | get { return m_ConfigSource; } |
177 | } | 177 | } |
178 | 178 | ||
179 | /// <summary> | ||
180 | /// Event fired after the script engine has finished removing a script. | ||
181 | /// </summary> | ||
179 | public event ScriptRemoved OnScriptRemoved; | 182 | public event ScriptRemoved OnScriptRemoved; |
183 | |||
184 | /// <summary> | ||
185 | /// Event fired after the script engine has finished removing a script from an object. | ||
186 | /// </summary> | ||
180 | public event ObjectRemoved OnObjectRemoved; | 187 | public event ObjectRemoved OnObjectRemoved; |
181 | 188 | ||
182 | // | ||
183 | // IRegionModule functions | ||
184 | // | ||
185 | public void Initialise(IConfigSource configSource) | 189 | public void Initialise(IConfigSource configSource) |
186 | { | 190 | { |
187 | if (configSource.Configs["XEngine"] == null) | 191 | if (configSource.Configs["XEngine"] == null) |
@@ -1118,7 +1122,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1118 | } | 1122 | } |
1119 | 1123 | ||
1120 | instance.ClearQueue(); | 1124 | instance.ClearQueue(); |
1121 | instance.Stop(0); | 1125 | |
1126 | // Give the script some time to finish processing its last event. Simply aborting the script thread can | ||
1127 | // cause issues on mono 2.6, 2.10 and possibly later where locks are not released properly on abort. | ||
1128 | instance.Stop(1000); | ||
1129 | |||
1122 | // bool objectRemoved = false; | 1130 | // bool objectRemoved = false; |
1123 | 1131 | ||
1124 | lock (m_PrimObjects) | 1132 | lock (m_PrimObjects) |
@@ -1149,14 +1157,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1149 | UnloadAppDomain(instance.AppDomain); | 1157 | UnloadAppDomain(instance.AppDomain); |
1150 | } | 1158 | } |
1151 | 1159 | ||
1152 | instance = null; | ||
1153 | |||
1154 | ObjectRemoved handlerObjectRemoved = OnObjectRemoved; | 1160 | ObjectRemoved handlerObjectRemoved = OnObjectRemoved; |
1155 | if (handlerObjectRemoved != null) | 1161 | if (handlerObjectRemoved != null) |
1156 | { | 1162 | handlerObjectRemoved(instance.ObjectID); |
1157 | SceneObjectPart part = m_Scene.GetSceneObjectPart(localID); | ||
1158 | handlerObjectRemoved(part.UUID); | ||
1159 | } | ||
1160 | 1163 | ||
1161 | ScriptRemoved handlerScriptRemoved = OnScriptRemoved; | 1164 | ScriptRemoved handlerScriptRemoved = OnScriptRemoved; |
1162 | if (handlerScriptRemoved != null) | 1165 | if (handlerScriptRemoved != null) |