1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-10 14:16:00 +01:00

SMACK-270 MultiUserChat relied on finalize() being called in order to remove packet listeners and the association with RoomListenerMultiplexor. The PacketListeners are referenced by Connection, which meant that MultiUserChat is always strongly reachable until the connection dies.

This patch introduces an new MultiUserChat.cleanup() method that is called when userHashLeft() is triggered.

Thanks to Stuart Chalmers and scgmile for reporting this.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@13418 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Florian Schmaus 2013-01-31 22:30:49 +00:00 committed by flow
parent a75d2d7d0d
commit e75f45082b

View file

@ -1986,6 +1986,7 @@ public class MultiUserChat {
return;
}
rooms.remove(room);
cleanup();
}
/**
@ -2530,7 +2531,7 @@ public class MultiUserChat {
}
}
protected void finalize() throws Throwable {
private void cleanup() {
try {
if (connection != null) {
roomListenerMultiplexor.removeRoom(room);
@ -2539,10 +2540,13 @@ public class MultiUserChat {
connection.removePacketListener(connectionListener);
}
}
}
catch (Exception e) {
} catch (Exception e) {
// Do nothing
}
}
protected void finalize() throws Throwable {
cleanup();
super.finalize();
}