Fixes possible memory leak in the chat rooms when the user leaving or destroying the chat room.

ice4sip 5084
hristoterezov 12 years ago
parent 5810b3199b
commit 3ee2cd893c

@ -166,6 +166,11 @@ public class ChatRoomJabberImpl
private List<CallJabberImpl> chatRoomConferenceCalls
= new ArrayList<CallJabberImpl>();
/**
* The Presence listener instance.
*/
private PresenceListener presenceListener = null;
/**
* Creates an instance of a chat room that has been.
*
@ -586,8 +591,9 @@ public void joinAs(String nickname, byte[] password)
}
else
{
presenceListener = new PresenceListener(this);
this.provider.getConnection().addPacketListener(
new PresenceListener(this),
presenceListener,
new AndFilter(
new FromMatchesFilter(multiUserChat.getRoom()),
new PacketTypeFilter(
@ -909,7 +915,14 @@ private void leave(String reason, String alternateAddress)
// connection can be null if we are leaving cause connection failed
if(connection != null)
{
connection.removePacketListener(invitationRejectionListeners);
if(presenceListener != null)
{
connection.removePacketListener(presenceListener);
presenceListener = null;
}
}
opSetMuc.fireLocalUserPresenceEvent(
this,

Loading…
Cancel
Save