remove callbacks directly from iterator

This commit is contained in:
Daniel Gultsch 2015-08-23 10:20:29 +02:00
parent 1688b65965
commit 3d6fb9b21d
1 changed files with 2 additions and 2 deletions

View File

@ -750,13 +750,13 @@ public class XmppConnection implements Runnable {
while (iterator.hasNext()) { while (iterator.hasNext()) {
Pair<IqPacket, OnIqPacketReceived> entry = iterator.next(); Pair<IqPacket, OnIqPacketReceived> entry = iterator.next();
callbacks.add(entry.second); callbacks.add(entry.second);
iterator.remove();
} }
this.packetCallbacks.clear();
} }
for(OnIqPacketReceived callback : callbacks) { for(OnIqPacketReceived callback : callbacks) {
callback.onIqPacketReceived(account,failurePacket); callback.onIqPacketReceived(account,failurePacket);
} }
Log.d(Config.LOGTAG,account.getJid().toBareJid()+": done clearing iq callbacks"); Log.d(Config.LOGTAG,account.getJid().toBareJid()+": done clearing iq callbacks. "+this.packetCallbacks.size()+" left");
} }
private void sendStartSession() { private void sendStartSession() {