remove some Xengine errors on scripted object delete

avinationmerge
UbitUmarov 2014-10-22 10:21:54 +01:00
parent 31c036c044
commit 382df37f80
1 changed files with 8 additions and 14 deletions

View File

@ -1478,19 +1478,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
// Do we even have it? // Do we even have it?
if (!m_Scripts.ContainsKey(itemID)) if (!m_Scripts.ContainsKey(itemID))
{ {
// Do we even have it?
if (!m_Scripts.ContainsKey(itemID))
return;
lockScriptsForRead(false); lockScriptsForRead(false);
lockScriptsForWrite(true);
m_Scripts.Remove(itemID);
lockScriptsForWrite(false);
return; return;
} }
IScriptInstance instance=m_Scripts[itemID]; IScriptInstance instance=m_Scripts[itemID];
lockScriptsForRead(false); lockScriptsForRead(false);
lockScriptsForWrite(true); lockScriptsForWrite(true);
@ -1523,11 +1514,14 @@ namespace OpenSim.Region.ScriptEngine.XEngine
instance.RemoveState(); instance.RemoveState();
instance.DestroyScriptInstance(); instance.DestroyScriptInstance();
m_DomainScripts[instance.AppDomain].Remove(instance.ItemID); if (m_DomainScripts.ContainsKey(instance.AppDomain))
if (m_DomainScripts[instance.AppDomain].Count == 0)
{ {
m_DomainScripts.Remove(instance.AppDomain); m_DomainScripts[instance.AppDomain].Remove(instance.ItemID);
UnloadAppDomain(instance.AppDomain); if (m_DomainScripts[instance.AppDomain].Count == 0)
{
m_DomainScripts.Remove(instance.AppDomain);
UnloadAppDomain(instance.AppDomain);
}
} }
ObjectRemoved handlerObjectRemoved = OnObjectRemoved; ObjectRemoved handlerObjectRemoved = OnObjectRemoved;