diff options
author | Damian Minkov <damencho@jitsi.org> | 2013-12-11 19:53:49 +0200 |
---|---|---|
committer | Damian Minkov <damencho@jitsi.org> | 2013-12-11 19:55:22 +0200 |
commit | 19f30212f510d07fde26dd8792cbfe1cb95a33dc (patch) | |
tree | 5d82926f460a3c09d131a9b82ed9d1d955db993e | |
parent | a690b00bc3d67ae06992cc679c8242089adae800 (diff) | |
download | jitsi-19f30212f510d07fde26dd8792cbfe1cb95a33dc.zip jitsi-19f30212f510d07fde26dd8792cbfe1cb95a33dc.tar.gz jitsi-19f30212f510d07fde26dd8792cbfe1cb95a33dc.tar.bz2 |
Fixes leaking HistoryWindows.
-rw-r--r-- | src/net/java/sip/communicator/impl/gui/main/chat/history/HistoryWindow.java | 64 |
1 files changed, 29 insertions, 35 deletions
diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/history/HistoryWindow.java b/src/net/java/sip/communicator/impl/gui/main/chat/history/HistoryWindow.java index e2b877a..1cd7d08 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/history/HistoryWindow.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/history/HistoryWindow.java @@ -380,37 +380,6 @@ public class HistoryWindow } /** - * Indicates that the window is closing. Removes all message listeners when - * closing. - * @param e the <tt>WindowEvent</tt> that notified us - */ - @Override - protected void windowClosing(WindowEvent e) - { - super.windowClosing(e); - - /* - * Remove all listeners in order to have this instance ready for garbage - * collection. - */ - - history.removeSearchProgressListener(this); - - if (basicInstantMessagings != null) - { - for (OperationSetBasicInstantMessaging basicInstantMessaging - : basicInstantMessagings) - basicInstantMessaging.removeMessageListener(this); - basicInstantMessagings = null; - } - if (chatRoom != null) - { - chatRoom.removeMessageListener(this); - chatRoom = null; - } - } - - /** * Returns the next date from the history. * When <tt>date</tt> is the last one, we return the current date, * means we are loading today messages (till now). @@ -774,11 +743,33 @@ public class HistoryWindow @Override protected void close(boolean isEscaped) { - if(chatConvPanel.getRightButtonMenu().isVisible()) + /* + * Remove all listeners in order to have this instance ready for garbage + * collection. + */ + history.removeSearchProgressListener(this); + + if (basicInstantMessagings != null) + { + for (OperationSetBasicInstantMessaging basicInstantMessaging + : basicInstantMessagings) + basicInstantMessaging.removeMessageListener(this); + basicInstantMessagings = null; + } + + if (chatRoom != null) + { + chatRoom.removeMessageListener(this); + chatRoom = null; + } + + if(chatConvPanel != null + && chatConvPanel.getRightButtonMenu() != null + && chatConvPanel.getRightButtonMenu().isVisible()) { chatConvPanel.getRightButtonMenu().setVisible(false); } - else if(historyMenu.isPopupMenuVisible()) + else if(historyMenu != null && historyMenu.isPopupMenuVisible()) { MenuSelectionManager.defaultManager().clearSelectedPath(); } @@ -787,8 +778,11 @@ public class HistoryWindow GuiActivator.getUIService().getHistoryWindowManager() .removeHistoryWindowForContact(historyContact); - datesPanel.dispose(); - chatConvPanel.dispose(); + if(datesPanel != null) + datesPanel.dispose(); + + if(chatConvPanel != null) + chatConvPanel.dispose(); this.dispose(); } |