diff --git a/source/org/jivesoftware/smackx/muc/MultiUserChat.java b/source/org/jivesoftware/smackx/muc/MultiUserChat.java index 870f4a38e..17c6f713e 100644 --- a/source/org/jivesoftware/smackx/muc/MultiUserChat.java +++ b/source/org/jivesoftware/smackx/muc/MultiUserChat.java @@ -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(); }