* This slightly extends a lock in WorldCommModule so that it covers the GetNewHandle method which states in it's doc that it assumes locking has happened before the method is 
called
* Thanks DoranZemlja
0.6.3-post-fixes
Justin Clarke Casey 2009-02-17 15:55:56 +00:00
parent 829c84e69f
commit 6bcf7cbb2c
1 changed files with 15 additions and 15 deletions

View File

@ -381,25 +381,25 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
if (m_curlisteners < m_maxlisteners) if (m_curlisteners < m_maxlisteners)
{ {
int newHandle = GetNewHandle(itemID); lock (m_listeners)
if (newHandle > 0)
{ {
ListenerInfo li = new ListenerInfo(newHandle, localID, itemID, hostID, channel, name, id, msg); int newHandle = GetNewHandle(itemID);
lock (m_listeners) if (newHandle > 0)
{ {
List<ListenerInfo> listeners; ListenerInfo li = new ListenerInfo(newHandle, localID, itemID, hostID, channel, name, id, msg);
if (!m_listeners.TryGetValue(channel,out listeners))
{
listeners = new List<ListenerInfo>();
m_listeners.Add(channel, listeners);
}
listeners.Add(li);
m_curlisteners++;
}
return newHandle; List<ListenerInfo> listeners;
if (!m_listeners.TryGetValue(channel,out listeners))
{
listeners = new List<ListenerInfo>();
m_listeners.Add(channel, listeners);
}
listeners.Add(li);
m_curlisteners++;
return newHandle;
}
} }
} }
return -1; return -1;