* Fix a null ref that causes a stack unwind when crossing borders. Less stack unwinding.. the faster it goes.

* Tweak XEngine so that it's partially functional again.    It's still not great, but basic things work.
(cherry picked from commit 01c3be2746)
avinationmerge
teravus 2013-08-24 05:55:53 -05:00
parent 2f365ea80b
commit 1c7accf950
3 changed files with 49 additions and 12 deletions

View File

@ -182,6 +182,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
try
{
ILandObject obj = avatar.Scene.LandChannel.GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
if (obj == null)
return;
if ((obj.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0
|| avatar.Scene.RegionInfo.RegionSettings.AllowDamage)
{

View File

@ -231,6 +231,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
ItemID = ScriptTask.ItemID;
AssetID = ScriptTask.AssetID;
}
LocalID = part.LocalId;
PrimName = part.ParentGroup.Name;
StartParam = startParam;
@ -1240,4 +1241,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
return null;
}
}
}
}

View File

@ -1316,13 +1316,21 @@ namespace OpenSim.Region.ScriptEngine.XEngine
ScriptInstance instance = null;
// Create the object record
UUID appDomain = assetID;
lockScriptsForRead(true);
if ((!m_Scripts.ContainsKey(itemID)) ||
(m_Scripts[itemID].AssetID != assetID))
{
lockScriptsForRead(false);
UUID appDomain = assetID;
instance = new ScriptInstance(this, part,
item,
startParam, postOnRez,
m_MaxScriptQueue);
if (part.ParentGroup.IsAttachment)
appDomain = part.ParentGroup.RootPart.UUID;
@ -1345,9 +1353,39 @@ namespace OpenSim.Region.ScriptEngine.XEngine
sandbox = AppDomain.CreateDomain(
m_Scene.RegionInfo.RegionID.ToString(),
evidence, appSetup);
m_AppDomains[appDomain].AssemblyResolve +=
new ResolveEventHandler(
AssemblyResolver.OnAssemblyResolve);
if (m_AppDomains.ContainsKey(appDomain))
{
m_AppDomains[appDomain].AssemblyResolve +=
new ResolveEventHandler(
AssemblyResolver.OnAssemblyResolve);
if (m_DomainScripts.ContainsKey(appDomain))
{
m_DomainScripts[appDomain].Add(itemID);
}
else
{
m_DomainScripts.Add(appDomain, new List<UUID>());
m_DomainScripts[appDomain].Add(itemID);
}
}
else
{
m_AppDomains.Add(appDomain, sandbox);
m_AppDomains[appDomain].AssemblyResolve +=
new ResolveEventHandler(
AssemblyResolver.OnAssemblyResolve);
if (m_DomainScripts.ContainsKey(appDomain))
{
m_DomainScripts[appDomain].Add(itemID);
}
else
{
m_DomainScripts.Add(appDomain, new List<UUID>());
m_DomainScripts[appDomain].Add(itemID);
}
}
}
else
{
@ -1373,12 +1411,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
return false;
}
}
m_DomainScripts[appDomain].Add(itemID);
instance = new ScriptInstance(this, part,
item,
startParam, postOnRez,
m_MaxScriptQueue);
instance.Load(m_AppDomains[appDomain], assembly, stateSource);
// m_log.DebugFormat(
@ -1502,6 +1535,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
if (handlerObjectRemoved != null)
{
SceneObjectPart part = m_Scene.GetSceneObjectPart(localID);
if (part != null)
handlerObjectRemoved(part.UUID);
}