diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/XEngine')
-rw-r--r-- | OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 56 |
1 files changed, 45 insertions, 11 deletions
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 9d1e143..27d7674 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -1316,13 +1316,21 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1316 | 1316 | ||
1317 | ScriptInstance instance = null; | 1317 | ScriptInstance instance = null; |
1318 | // Create the object record | 1318 | // Create the object record |
1319 | UUID appDomain = assetID; | ||
1320 | |||
1321 | |||
1322 | |||
1319 | lockScriptsForRead(true); | 1323 | lockScriptsForRead(true); |
1320 | if ((!m_Scripts.ContainsKey(itemID)) || | 1324 | if ((!m_Scripts.ContainsKey(itemID)) || |
1321 | (m_Scripts[itemID].AssetID != assetID)) | 1325 | (m_Scripts[itemID].AssetID != assetID)) |
1322 | { | 1326 | { |
1323 | lockScriptsForRead(false); | 1327 | lockScriptsForRead(false); |
1324 | 1328 | instance = new ScriptInstance(this, part, | |
1325 | UUID appDomain = assetID; | 1329 | item, |
1330 | startParam, postOnRez, | ||
1331 | m_MaxScriptQueue); | ||
1332 | |||
1333 | |||
1326 | 1334 | ||
1327 | if (part.ParentGroup.IsAttachment) | 1335 | if (part.ParentGroup.IsAttachment) |
1328 | appDomain = part.ParentGroup.RootPart.UUID; | 1336 | appDomain = part.ParentGroup.RootPart.UUID; |
@@ -1345,9 +1353,39 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1345 | sandbox = AppDomain.CreateDomain( | 1353 | sandbox = AppDomain.CreateDomain( |
1346 | m_Scene.RegionInfo.RegionID.ToString(), | 1354 | m_Scene.RegionInfo.RegionID.ToString(), |
1347 | evidence, appSetup); | 1355 | evidence, appSetup); |
1348 | m_AppDomains[appDomain].AssemblyResolve += | 1356 | if (m_AppDomains.ContainsKey(appDomain)) |
1349 | new ResolveEventHandler( | 1357 | { |
1350 | AssemblyResolver.OnAssemblyResolve); | 1358 | m_AppDomains[appDomain].AssemblyResolve += |
1359 | new ResolveEventHandler( | ||
1360 | AssemblyResolver.OnAssemblyResolve); | ||
1361 | if (m_DomainScripts.ContainsKey(appDomain)) | ||
1362 | { | ||
1363 | m_DomainScripts[appDomain].Add(itemID); | ||
1364 | } | ||
1365 | else | ||
1366 | { | ||
1367 | m_DomainScripts.Add(appDomain, new List<UUID>()); | ||
1368 | m_DomainScripts[appDomain].Add(itemID); | ||
1369 | } | ||
1370 | } | ||
1371 | else | ||
1372 | { | ||
1373 | m_AppDomains.Add(appDomain, sandbox); | ||
1374 | m_AppDomains[appDomain].AssemblyResolve += | ||
1375 | new ResolveEventHandler( | ||
1376 | AssemblyResolver.OnAssemblyResolve); | ||
1377 | if (m_DomainScripts.ContainsKey(appDomain)) | ||
1378 | { | ||
1379 | m_DomainScripts[appDomain].Add(itemID); | ||
1380 | } | ||
1381 | else | ||
1382 | { | ||
1383 | m_DomainScripts.Add(appDomain, new List<UUID>()); | ||
1384 | m_DomainScripts[appDomain].Add(itemID); | ||
1385 | } | ||
1386 | |||
1387 | } | ||
1388 | |||
1351 | } | 1389 | } |
1352 | else | 1390 | else |
1353 | { | 1391 | { |
@@ -1373,12 +1411,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1373 | return false; | 1411 | return false; |
1374 | } | 1412 | } |
1375 | } | 1413 | } |
1376 | m_DomainScripts[appDomain].Add(itemID); | 1414 | |
1377 | |||
1378 | instance = new ScriptInstance(this, part, | ||
1379 | item, | ||
1380 | startParam, postOnRez, | ||
1381 | m_MaxScriptQueue); | ||
1382 | 1415 | ||
1383 | instance.Load(m_AppDomains[appDomain], assembly, stateSource); | 1416 | instance.Load(m_AppDomains[appDomain], assembly, stateSource); |
1384 | // m_log.DebugFormat( | 1417 | // m_log.DebugFormat( |
@@ -1502,6 +1535,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1502 | if (handlerObjectRemoved != null) | 1535 | if (handlerObjectRemoved != null) |
1503 | { | 1536 | { |
1504 | SceneObjectPart part = m_Scene.GetSceneObjectPart(localID); | 1537 | SceneObjectPart part = m_Scene.GetSceneObjectPart(localID); |
1538 | if (part != null) | ||
1505 | handlerObjectRemoved(part.UUID); | 1539 | handlerObjectRemoved(part.UUID); |
1506 | } | 1540 | } |
1507 | 1541 | ||