Patch #9141 (Mantis #1655)

Untangles llDie handling in XEngine, which resulted in a thread being
aborted while executing inside of Scene.
0.6.0-stable
Melanie Thielker 2008-07-12 00:06:45 +00:00
parent b42770bf7a
commit 746c6fb1a2
3 changed files with 25 additions and 3 deletions

View File

@ -637,7 +637,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llDie()
{
m_host.AddScriptLPS(1);
World.DeleteSceneObject(m_host.ParentGroup);
throw new SelfDeleteException();
}
public double llGround(LSL_Types.Vector3 offset)

View File

@ -52,6 +52,20 @@ namespace OpenSim.Region.ScriptEngine.Shared
}
}
[Serializable]
public class SelfDeleteException : Exception
{
public SelfDeleteException()
{
}
protected SelfDeleteException(
SerializationInfo info,
StreamingContext context)
{
}
}
public class DetectParams
{
public DetectParams()

View File

@ -874,6 +874,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
private string m_Assembly;
private int m_StartParam = 0;
private string m_CurrentEvent = String.Empty;
private bool m_InSelfDelete = false;
private Dictionary<string,IScriptApi> m_Apis = new Dictionary<string,IScriptApi>();
@ -1190,6 +1191,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
if (result == null)
return true;
if(!m_InSelfDelete)
result.Abort();
lock (m_EventQueue)
@ -1298,7 +1300,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
m_InEvent = false;
m_CurrentEvent = String.Empty;
if (!(e is TargetInvocationException) || !(e.InnerException is EventAbortException))
if (!(e is TargetInvocationException) || (!(e.InnerException is EventAbortException) && (!(e.InnerException is SelfDeleteException))))
{
if (e is System.Threading.ThreadAbortException)
{
@ -1340,6 +1342,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine
e.ToString());
}
}
else if((e is TargetInvocationException) && (e.InnerException is SelfDeleteException))
{
m_InSelfDelete = true;
if(part != null && part.ParentGroup != null)
m_Engine.World.DeleteSceneObject(part.ParentGroup);
}
}
}