One more stab at http://opensimulator.org/mantis/view.php?id=4858.
Eliminated the nested locks of m_Scripts and m_PrimObjects.prebuild-update
parent
cd2bb7daf3
commit
5c0c7fda6c
|
@ -820,60 +820,60 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
m_CompileDict.Remove(itemID);
|
m_CompileDict.Remove(itemID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IScriptInstance instance = null;
|
||||||
|
|
||||||
lock (m_Scripts)
|
lock (m_Scripts)
|
||||||
{
|
{
|
||||||
// Do we even have it?
|
// Do we even have it?
|
||||||
if (!m_Scripts.ContainsKey(itemID))
|
if (!m_Scripts.ContainsKey(itemID))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
IScriptInstance instance=m_Scripts[itemID];
|
instance=m_Scripts[itemID];
|
||||||
m_Scripts.Remove(itemID);
|
m_Scripts.Remove(itemID);
|
||||||
|
}
|
||||||
|
|
||||||
instance.ClearQueue();
|
instance.ClearQueue();
|
||||||
instance.Stop(0);
|
instance.Stop(0);
|
||||||
|
|
||||||
// bool objectRemoved = false;
|
// bool objectRemoved = false;
|
||||||
|
|
||||||
lock (m_PrimObjects)
|
lock (m_PrimObjects)
|
||||||
|
{
|
||||||
|
// Remove the script from it's prim
|
||||||
|
if (m_PrimObjects.ContainsKey(localID))
|
||||||
{
|
{
|
||||||
// Remove the script from it's prim
|
// Remove inventory item record
|
||||||
if (m_PrimObjects.ContainsKey(localID))
|
if (m_PrimObjects[localID].Contains(itemID))
|
||||||
{
|
m_PrimObjects[localID].Remove(itemID);
|
||||||
// Remove inventory item record
|
|
||||||
if (m_PrimObjects[localID].Contains(itemID))
|
|
||||||
m_PrimObjects[localID].Remove(itemID);
|
|
||||||
|
|
||||||
// If there are no more scripts, remove prim
|
// If there are no more scripts, remove prim
|
||||||
if (m_PrimObjects[localID].Count == 0)
|
if (m_PrimObjects[localID].Count == 0)
|
||||||
{
|
{
|
||||||
m_PrimObjects.Remove(localID);
|
m_PrimObjects.Remove(localID);
|
||||||
// objectRemoved = true;
|
// objectRemoved = true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
instance.RemoveState();
|
|
||||||
instance.DestroyScriptInstance();
|
|
||||||
|
|
||||||
m_DomainScripts[instance.AppDomain].Remove(instance.ItemID);
|
|
||||||
if (m_DomainScripts[instance.AppDomain].Count == 0)
|
|
||||||
{
|
|
||||||
m_DomainScripts.Remove(instance.AppDomain);
|
|
||||||
UnloadAppDomain(instance.AppDomain);
|
|
||||||
}
|
|
||||||
|
|
||||||
instance = null;
|
|
||||||
|
|
||||||
ObjectRemoved handlerObjectRemoved = OnObjectRemoved;
|
|
||||||
if (handlerObjectRemoved != null)
|
|
||||||
{
|
|
||||||
SceneObjectPart part = m_Scene.GetSceneObjectPart(localID);
|
|
||||||
handlerObjectRemoved(part.UUID);
|
|
||||||
}
|
|
||||||
|
|
||||||
CleanAssemblies();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
instance.RemoveState();
|
||||||
|
instance.DestroyScriptInstance();
|
||||||
|
|
||||||
|
m_DomainScripts[instance.AppDomain].Remove(instance.ItemID);
|
||||||
|
if (m_DomainScripts[instance.AppDomain].Count == 0)
|
||||||
|
{
|
||||||
|
m_DomainScripts.Remove(instance.AppDomain);
|
||||||
|
UnloadAppDomain(instance.AppDomain);
|
||||||
|
}
|
||||||
|
|
||||||
|
instance = null;
|
||||||
|
|
||||||
|
ObjectRemoved handlerObjectRemoved = OnObjectRemoved;
|
||||||
|
if (handlerObjectRemoved != null)
|
||||||
|
{
|
||||||
|
SceneObjectPart part = m_Scene.GetSceneObjectPart(localID);
|
||||||
|
handlerObjectRemoved(part.UUID);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ScriptRemoved handlerScriptRemoved = OnScriptRemoved;
|
ScriptRemoved handlerScriptRemoved = OnScriptRemoved;
|
||||||
if (handlerScriptRemoved != null)
|
if (handlerScriptRemoved != null)
|
||||||
handlerScriptRemoved(itemID);
|
handlerScriptRemoved(itemID);
|
||||||
|
|
Loading…
Reference in New Issue