From: Christopher Yeoh <yeohc@au1.ibm.com>
This patch fixes the problem where if an object containing a script is deleted at the same time as an object containing the same script is rezzed, it can result in the assembly file being deleted after the second object script initialisation has found it but not started using it yet, resulting in the script not starting up.0.6.3-post-fixes
parent
2a998d6cd7
commit
efcf00ee60
|
@ -100,6 +100,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
|||
private Dictionary<UUID, string> m_Assemblies =
|
||||
new Dictionary<UUID, string>();
|
||||
|
||||
private Dictionary<string, int> m_AddingAssemblies =
|
||||
new Dictionary<string, int>();
|
||||
|
||||
// This will list AppDomains by script asset
|
||||
|
||||
private Dictionary<UUID, AppDomain> m_AppDomains =
|
||||
|
@ -508,9 +511,17 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
|||
Thread.CurrentThread.CurrentCulture = USCulture;
|
||||
|
||||
try
|
||||
{
|
||||
lock (m_AddingAssemblies)
|
||||
{
|
||||
assembly = m_Compiler.PerformScriptCompile(script,
|
||||
assetID.ToString());
|
||||
if (!m_AddingAssemblies.ContainsKey(assembly)) {
|
||||
m_AddingAssemblies[assembly] = 1;
|
||||
} else {
|
||||
m_AddingAssemblies[assembly]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -592,6 +603,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
|||
m_log.ErrorFormat("[XEngine] Exception creating app domain:\n {0}", e.ToString());
|
||||
m_ScriptErrorMessage += "Exception creating app domain:\n";
|
||||
m_ScriptFailCount++;
|
||||
lock (m_AddingAssemblies)
|
||||
{
|
||||
m_AddingAssemblies[assembly]--;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -626,6 +641,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
|||
if (!m_Assemblies.ContainsKey(assetID))
|
||||
m_Assemblies[assetID] = assembly;
|
||||
|
||||
lock (m_AddingAssemblies)
|
||||
{
|
||||
m_AddingAssemblies[assembly]--;
|
||||
}
|
||||
|
||||
if (instance!=null)
|
||||
instance.Init();
|
||||
}
|
||||
|
@ -710,8 +730,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
|||
assetIDList.Remove(i.AssetID);
|
||||
}
|
||||
|
||||
lock (m_AddingAssemblies)
|
||||
{
|
||||
foreach (UUID assetID in assetIDList)
|
||||
{
|
||||
// Do not remove assembly files if another instance of the script
|
||||
// is currently initialising
|
||||
if (!m_AddingAssemblies.ContainsKey(m_Assemblies[assetID])
|
||||
|| m_AddingAssemblies[m_Assemblies[assetID]] == 0)
|
||||
{
|
||||
// m_log.DebugFormat("[XEngine] Removing unreferenced assembly {0}", m_Assemblies[assetID]);
|
||||
try
|
||||
{
|
||||
|
@ -730,6 +757,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
|||
m_Assemblies.Remove(assetID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UnloadAppDomain(UUID id)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue