From 0c931e365763b38effb403357d78b99bbba40fbc Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 2 Mar 2012 00:22:23 +0000 Subject: [PATCH] lock SenseRepeatListLock when added a new sensor during script reconstitution. This is already being done in the other place where a sensor is added. Adding a sensor whilst another thread is iterating over the sensor list can cause a concurrency exception. --- .../Shared/Api/Implementation/Plugins/SensorRepeat.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index 4ac7f8bdbd..818f4b21dd 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs @@ -583,7 +583,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins ts.next = DateTime.Now.ToUniversalTime().AddSeconds(ts.interval); - SenseRepeaters.Add(ts); + lock (SenseRepeatListLock) + SenseRepeaters.Add(ts); + idx += 6; } }