From 97ff01a0c2d19100aa90484ccf9e17b16903af71 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 23 Mar 2015 22:15:25 +0100 Subject: Taking a reference to the value collection is not thread safe. Change this to create a shallow copy instead and then iterate it's values to avoid the "out of sync" error. --- .../Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs index 68aacd2..5b1fdc0 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs @@ -123,14 +123,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins if (Timers.Count == 0) return; - Dictionary.ValueCollection tvals; + Dictionary tvals; lock (TimerListLock) { // Go through all timers - tvals = Timers.Values; + tvals = new Dictionary(Timers); } - foreach (TimerInfo ts in tvals) + foreach (TimerInfo ts in tvals.Values) { // Time has passed? if (ts.next < DateTime.Now.Ticks) -- cgit v1.1