v0.4.3c: reverted some changes made to signal which were causing concurrent modification errors
This commit is contained in:
parent
f5cf285ddf
commit
d9818f3a1a
|
@ -68,14 +68,19 @@ public class Signal<T> {
|
|||
|
||||
public synchronized void dispatch( T t ) {
|
||||
|
||||
canceled = false;
|
||||
for (Listener<T> listener : listeners) {
|
||||
@SuppressWarnings("unchecked")
|
||||
Listener<T>[] list = listeners.toArray( new Listener[0] );
|
||||
|
||||
listener.onSignal( t );
|
||||
if (canceled) {
|
||||
return;
|
||||
canceled = false;
|
||||
for (Listener<T> listener : list) {
|
||||
|
||||
if (listeners.contains(listener)) {
|
||||
listener.onSignal(t);
|
||||
if (canceled) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user