aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala/src/module/util.vala
diff options
context:
space:
mode:
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;
}
}