aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala/src/module/util.vala
diff options
context:
space:
mode:
authorfiaxh <git@mx.ax.lt>2018-04-17 20:11:44 +0200
committerfiaxh <git@mx.ax.lt>2018-04-17 22:13:05 +0200
commitc656c7e9c274f3426527355320c0c22549c7792b (patch)
tree8f17679f6ef1fad0ea5f4a1713122a06b5b205c9 /xmpp-vala/src/module/util.vala
parent105006c5f10e4c3cba7f0a6211215b07343e7c7d (diff)
downloaddino-c656c7e9c274f3426527355320c0c22549c7792b.tar.gz
dino-c656c7e9c274f3426527355320c0c22549c7792b.zip
small fixes
Diffstat (limited to 'xmpp-vala/src/module/util.vala')
-rw-r--r--xmpp-vala/src/module/util.vala9
1 files changed, 7 insertions, 2 deletions
diff --git a/xmpp-vala/src/module/util.vala b/xmpp-vala/src/module/util.vala
index 849aeeec..cb11418c 100644
--- a/xmpp-vala/src/module/util.vala
+++ b/xmpp-vala/src/module/util.vala
@@ -20,9 +20,14 @@ public abstract class StanzaListener<T> : OrderedListener {
public class StanzaListenerHolder<T> : ListenerHolder {
public async void run(XmppStream stream, T stanza) {
- foreach (OrderedListener ol in listeners) {
+
+ // listeners can change e.g. when switching to another stream
+ ArrayList<OrderedListener> listeners_copy = new ArrayList<OrderedListener>();
+ listeners_copy.add_all(listeners);
+
+ foreach (OrderedListener ol in listeners_copy) {
StanzaListener<T> l = ol as StanzaListener<T>;
- bool stop = yield l.run(stream, stanza);
+ bool stop = yield l.run(stream, stanza);
if (stop) break;
}
}