* 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 try
{ {
ILandObject obj = avatar.Scene.LandChannel.GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); ILandObject obj = avatar.Scene.LandChannel.GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
if (obj == null)
return;
if ((obj.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0 if ((obj.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0
|| avatar.Scene.RegionInfo.RegionSettings.AllowDamage) || avatar.Scene.RegionInfo.RegionSettings.AllowDamage)
{ {

View File

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

View File

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