aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip
diff options
context:
space:
mode:
authorDamian Minkov <damencho@jitsi.org>2012-09-25 09:44:08 +0000
committerDamian Minkov <damencho@jitsi.org>2012-09-25 09:44:08 +0000
commit01fabbeeec92e8be543db64bb7d87638ff48ef7e (patch)
treeb4fdc31fc4f0002d39568a3830699ee7a0b6f084 /src/net/java/sip
parent5f8c5a906307d082198f8253626288a03df66818 (diff)
downloadjitsi-01fabbeeec92e8be543db64bb7d87638ff48ef7e.zip
jitsi-01fabbeeec92e8be543db64bb7d87638ff48ef7e.tar.gz
jitsi-01fabbeeec92e8be543db64bb7d87638ff48ef7e.tar.bz2
Fixes leaking queries and their results. Fixes memory leaking xml texts in chat panel. Autoaway configuration saved while typing.
Diffstat (limited to 'src/net/java/sip')
-rwxr-xr-xsrc/net/java/sip/communicator/impl/gui/main/chat/ChatConversationPanel.java11
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java2
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/contactlist/UIFilterQuery.java18
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/ShowMoreContact.java7
-rw-r--r--src/net/java/sip/communicator/plugin/generalconfig/autoaway/AutoAwayConfigurationPanel.java10
5 files changed, 47 insertions, 1 deletions
diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/ChatConversationPanel.java b/src/net/java/sip/communicator/impl/gui/main/chat/ChatConversationPanel.java
index 3ec57fa..3097ed4 100755
--- a/src/net/java/sip/communicator/impl/gui/main/chat/ChatConversationPanel.java
+++ b/src/net/java/sip/communicator/impl/gui/main/chat/ChatConversationPanel.java
@@ -1772,4 +1772,15 @@ public class ChatConversationPanel
return GuiActivator.getResources().getImageURL(
"service.gui.DEFAULT_USER_PHOTO_SMALL").toString();
}
+
+ /**
+ * Releases the resources allocated by this instance throughout its lifetime
+ * and prepares it for garbage collection.
+ */
+ public void dispose()
+ {
+ super.dispose();
+
+ clear();
+ }
} \ No newline at end of file
diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java b/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java
index d39b7a0..0633c2c 100644
--- a/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java
+++ b/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java
@@ -906,7 +906,7 @@ public class ChatPanel
* Passes the message to the contained <code>ChatConversationPanel</code>
* for processing and replaces the specified message with this one.
*
- * @param chatMessage The message used as a correction.
+ * @param message The message used as a correction.
*/
private void applyMessageCorrection(ChatMessage message)
{
diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/UIFilterQuery.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/UIFilterQuery.java
index d4072f4..20f38d0 100644
--- a/src/net/java/sip/communicator/impl/gui/main/contactlist/UIFilterQuery.java
+++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/UIFilterQuery.java
@@ -70,6 +70,15 @@ public class UIFilterQuery
private final ContactList contactList;
/**
+ * Map of the created show more contacts for a query.
+ * We stored them, so we can remove them (sometimes those
+ * contacts are not added to UI, so they are not removed and
+ * not cleared)
+ */
+ private final Map<ContactQuery,ShowMoreContact> showMoreContactMap
+ = new HashMap<ContactQuery, ShowMoreContact>();
+
+ /**
* Creates an instance of <tt>UIFilterQuery</tt> by specifying the parent
* <tt>ContactList</tt>.
*
@@ -299,6 +308,14 @@ public class UIFilterQuery
contactQuery.removeContactQueryListener(contactList);
if (!isSucceeded && contactQuery.getQueryResults().size() > 0)
isSucceeded = true;
+
+ // removes ShowMoreContact and clears it
+ ShowMoreContact showMoreContact
+ = showMoreContactMap.remove(contactQuery);
+ if(showMoreContact != null)
+ {
+ showMoreContact.setContactNode(null);
+ }
}
else if (query instanceof MetaContactQuery)
{
@@ -343,6 +360,7 @@ public class UIFilterQuery
ShowMoreContact moreInfoContact
= new ShowMoreContact(query, queryResults, getMaxResultShown());
+ showMoreContactMap.put(query, moreInfoContact);
ContactSourceService contactSource = query.getContactSource();
diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/ShowMoreContact.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/ShowMoreContact.java
index 0ce9f0f..0c16357 100644
--- a/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/ShowMoreContact.java
+++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/ShowMoreContact.java
@@ -219,6 +219,13 @@ public class ShowMoreContact
public void setContactNode(ContactNode contactNode)
{
this.contactNode = contactNode;
+
+ // contactNode is null, when the the ui contact is removed/cleared
+ // we must free resources
+ if(contactNode == null)
+ {
+ GuiActivator.getContactList().removeContactListListener(this);
+ }
}
/**
diff --git a/src/net/java/sip/communicator/plugin/generalconfig/autoaway/AutoAwayConfigurationPanel.java b/src/net/java/sip/communicator/plugin/generalconfig/autoaway/AutoAwayConfigurationPanel.java
index 2e61953..3c5a144 100644
--- a/src/net/java/sip/communicator/plugin/generalconfig/autoaway/AutoAwayConfigurationPanel.java
+++ b/src/net/java/sip/communicator/plugin/generalconfig/autoaway/AutoAwayConfigurationPanel.java
@@ -11,6 +11,7 @@ import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
+import javax.swing.text.*;
import net.java.sip.communicator.plugin.generalconfig.*;
import net.java.sip.communicator.util.swing.*;
@@ -102,6 +103,15 @@ public class AutoAwayConfigurationPanel
"plugin.autoaway.AWAY_MINUTES")));
timerPanel.add(timer);
+ try
+ {
+ // changes that are valid will be saved immediately while typing
+ ((DefaultFormatter)((JSpinner.DefaultEditor)timer.getEditor())
+ .getTextField().getFormatter()).setCommitsOnValidEdit(true);
+ }
+ catch(Throwable t)
+ {}
+
JPanel mainPanel = new TransparentPanel(new BorderLayout(5, 5));
mainPanel.add(enable, BorderLayout.NORTH);