diff options
author | Artur Signell <artur.signell@itmill.com> | 2009-11-25 17:49:17 +0000 |
---|---|---|
committer | Artur Signell <artur.signell@itmill.com> | 2009-11-25 17:49:17 +0000 |
commit | 1d89da47d29849dc41d7c5f2f68700eb5e918b8d (patch) | |
tree | ebb7c433c682784da404f90a608bf1488e527826 /src/com/vaadin/event/EventRouter.java | |
parent | 3de11ab062646763ce0fa1671ba35e6e7117fb24 (diff) | |
download | vaadin-framework-1d89da47d29849dc41d7c5f2f68700eb5e918b8d.tar.gz vaadin-framework-1d89da47d29849dc41d7c5f2f68700eb5e918b8d.zip |
Merged changes from trunk
svn changeset:10040/svn branch:event-framework-3234
Diffstat (limited to 'src/com/vaadin/event/EventRouter.java')
-rw-r--r-- | src/com/vaadin/event/EventRouter.java | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/com/vaadin/event/EventRouter.java b/src/com/vaadin/event/EventRouter.java index b12a280262..dd13445e93 100644 --- a/src/com/vaadin/event/EventRouter.java +++ b/src/com/vaadin/event/EventRouter.java @@ -138,13 +138,17 @@ public class EventRouter implements MethodEventSource { public void fireEvent(EventObject event) { // It is not necessary to send any events if there are no listeners if (listenerList != null) { + + // Make a copy of the listener list to allow listeners to be added + // inside listener methods. Fixes #3605. + // Send the event to all listeners. The listeners themselves // will filter out unwanted events. - - final Iterator<ListenerMethod> i = listenerList.iterator(); - while (i.hasNext()) { - (i.next()).receiveEvent(event); + final Object[] listeners = listenerList.toArray(); + for (int i = 0; i < listeners.length; i++) { + ((ListenerMethod) listeners[i]).receiveEvent(event); } + } } |