Inconsistent locking of SenseRepeaters in Script Engine.

When I attempt to 'save oar' on a region with thousands of scripts with timers, I get a NullReferenceException every time. The problem comes from inconsistent locking in SensorRepeat.cs of the SenseRepeaters List. It is iterated and modified in many places and these places are all wrapped in a lock except in the GetSerializationData(). This is the function throwing the exception because an item in the list becomes null during iteration.

The attached patch locks SenseRepeatListLock in GetSerializationData()
0.6.8-post-fixes
unknown 2009-10-23 03:52:49 -07:00 committed by Melanie
parent b0923e0d73
commit 71c929137f
1 changed files with 11 additions and 8 deletions

View File

@ -516,6 +516,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
{
List<Object> data = new List<Object>();
lock (SenseRepeatListLock)
{
foreach (SenseRepeatClass ts in SenseRepeaters)
{
if (ts.itemID == itemID)
@ -528,6 +530,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
data.Add(ts.arc);
}
}
}
return data.ToArray();
}