mirror of
https://github.com/opensim/opensim.git
synced 2026-08-04 08:06:27 +08:00
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()
This commit is contained in:
@@ -516,16 +516,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||
{
|
||||
List<Object> data = new List<Object>();
|
||||
|
||||
foreach (SenseRepeatClass ts in SenseRepeaters)
|
||||
lock (SenseRepeatListLock)
|
||||
{
|
||||
if (ts.itemID == itemID)
|
||||
foreach (SenseRepeatClass ts in SenseRepeaters)
|
||||
{
|
||||
data.Add(ts.interval);
|
||||
data.Add(ts.name);
|
||||
data.Add(ts.keyID);
|
||||
data.Add(ts.type);
|
||||
data.Add(ts.range);
|
||||
data.Add(ts.arc);
|
||||
if (ts.itemID == itemID)
|
||||
{
|
||||
data.Add(ts.interval);
|
||||
data.Add(ts.name);
|
||||
data.Add(ts.keyID);
|
||||
data.Add(ts.type);
|
||||
data.Add(ts.range);
|
||||
data.Add(ts.arc);
|
||||
}
|
||||
}
|
||||
}
|
||||
return data.ToArray();
|
||||
|
||||
Reference in New Issue
Block a user