From dcfd05c8eaa4550d9be4c673d660497da1e035c8 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 2 Mar 2012 00:22:23 +0000 Subject: 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. --- .../ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index 5c1bdff..8383c7f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs @@ -635,7 +635,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; } } -- cgit v1.1