diff options
Diffstat (limited to 'src/jrummikub/util')
-rw-r--r-- | src/jrummikub/util/Event1.java | 2 | ||||
-rw-r--r-- | src/jrummikub/util/Event2.java | 2 | ||||
-rw-r--r-- | src/jrummikub/util/Event3.java | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/src/jrummikub/util/Event1.java b/src/jrummikub/util/Event1.java index 5e3391c..f93d519 100644 --- a/src/jrummikub/util/Event1.java +++ b/src/jrummikub/util/Event1.java @@ -35,7 +35,7 @@ public class Event1<T> implements IEvent1<T> { * the event parameter */ public void emit(T value) { - for (IListener1<T> listener : listeners) { + for (IListener1<T> listener : new HashSet<IListener1<T>>(listeners)) { listener.handle(value); } } diff --git a/src/jrummikub/util/Event2.java b/src/jrummikub/util/Event2.java index 9bcee43..139f19f 100644 --- a/src/jrummikub/util/Event2.java +++ b/src/jrummikub/util/Event2.java @@ -39,7 +39,7 @@ public class Event2<T1, T2> implements IEvent2<T1, T2> { * the second event parameter */ public void emit(T1 value1, T2 value2) { - for (IListener2<T1, T2> listener : listeners) { + for (IListener2<T1, T2> listener : new HashSet<IListener2<T1, T2>>(listeners)) { listener.handle(value1, value2); } } diff --git a/src/jrummikub/util/Event3.java b/src/jrummikub/util/Event3.java index 38cdd07..9510e48 100644 --- a/src/jrummikub/util/Event3.java +++ b/src/jrummikub/util/Event3.java @@ -43,7 +43,7 @@ public class Event3<T1, T2, T3> implements IEvent3<T1, T2, T3> { * the third event parameter */ public void emit(T1 value1, T2 value2, T3 value3) { - for (IListener3<T1, T2, T3> listener : listeners) { + for (IListener3<T1, T2, T3> listener : new HashSet<IListener3<T1, T2, T3>>(listeners)) { listener.handle(value1, value2, value3); } } |